[ty] Emit error for invalid binary operations in type expressions (#18991)
## Summary This PR adds diagnostic for invalid binary operators in type expressions. It should close https://github.com/astral-sh/ty/issues/706 if merged. Please feel free to suggest better wordings for the diagnostic message. ## Test Plan I modified `mdtest/annotations/invalid.md` and added a test for each binary operator, and fixed tests that was broken by the new diagnostic.
This commit is contained in:
@@ -154,6 +154,7 @@ shouldn't panic.
|
||||
```py
|
||||
a: "1 or 2"
|
||||
b: "(x := 1)"
|
||||
# error: [invalid-type-form]
|
||||
c: "1 + 2"
|
||||
d: "lambda x: x"
|
||||
e: "x if True else y"
|
||||
|
||||
Reference in New Issue
Block a user