Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions crates/ty_ide/src/goto_type_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:15:1
|
13 | # Types
14 | Unknown = object()
15 | AlwaysTruthy = object()
14 | Unknown: _SpecialForm
15 | AlwaysTruthy: _SpecialForm
| ------------
16 | AlwaysFalsy = object()
16 | AlwaysFalsy: _SpecialForm
|
");
}
Expand Down Expand Up @@ -939,10 +939,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
"#);
}
Expand Down Expand Up @@ -1003,10 +1003,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
"#);
}
Expand All @@ -1030,10 +1030,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
"#);
}
Expand All @@ -1057,10 +1057,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
"#);
}
Expand Down Expand Up @@ -1249,10 +1249,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
"#);
}
Expand Down Expand Up @@ -2042,10 +2042,10 @@ def function():
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| -------
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
");
}
Expand Down
42 changes: 21 additions & 21 deletions crates/ty_ide/src/inlay_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2324,10 +2324,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| ^^^^^^^
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
info: Source
--> main2.py:5:18
Expand Down Expand Up @@ -2664,7 +2664,7 @@ mod tests {
"#,
);

assert_snapshot!(test.inlay_hints(), @r###"
assert_snapshot!(test.inlay_hints(), @r#"

a[: list[int]] = [1, 2]
b[: list[int | float]] = [1.0, 2.0]
Expand Down Expand Up @@ -3164,7 +3164,7 @@ mod tests {
i: list[bytes] = [b'/x01', b'/x02']
j: list[int | float] = [+1, +2.0]
k: list[int | float] = [-1, -2.0]
"###);
"#);
}

#[test]
Expand Down Expand Up @@ -3349,7 +3349,7 @@ mod tests {
"#,
);

assert_snapshot!(test.inlay_hints(), @r###"
assert_snapshot!(test.inlay_hints(), @r#"

class MyClass[T, U]:
def __init__(self, x: list[T], y: tuple[U, U]):
Expand Down Expand Up @@ -4083,7 +4083,7 @@ mod tests {
y: tuple[MyClass[int, str], MyClass[int, str]] = (MyClass([42], ("a", "b")), MyClass([42], ("a", "b")))
a, b = MyClass([42], ("a", "b")), MyClass([42], ("a", "b"))
c, d = (MyClass([42], ("a", "b")), MyClass([42], ("a", "b")))
"###);
"#);
}

#[test]
Expand Down Expand Up @@ -4387,7 +4387,7 @@ mod tests {
foo(y[0])",
);

assert_snapshot!(test.inlay_hints(), @r###"
assert_snapshot!(test.inlay_hints(), @r#"

def foo(x: int): pass
x[: list[int]] = [1]
Expand Down Expand Up @@ -4496,7 +4496,7 @@ mod tests {

foo(x[0])
foo(y[0])
"###);
"#);
}

#[test]
Expand Down Expand Up @@ -5525,10 +5525,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| ^^^^^^^
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
info: Source
--> main2.py:2:14
Expand All @@ -5543,10 +5543,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| ^^^^^^^
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
info: Source
--> main2.py:3:17
Expand Down Expand Up @@ -6530,10 +6530,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| ^^^^^^^
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
info: Source
--> main2.py:4:63
Expand Down Expand Up @@ -7260,10 +7260,10 @@ mod tests {
--> stdlib/ty_extensions.pyi:14:1
|
13 | # Types
14 | Unknown = object()
14 | Unknown: _SpecialForm
| ^^^^^^^
15 | AlwaysTruthy = object()
16 | AlwaysFalsy = object()
15 | AlwaysTruthy: _SpecialForm
16 | AlwaysFalsy: _SpecialForm
|
info: Source
--> main2.py:4:22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ async def outer_async(): # avoid unrelated syntax errors on `yield` and `await`
b: 2.3, # error: [invalid-type-form] "Float literals are not allowed in type expressions"
c: 4j, # error: [invalid-type-form] "Complex literals are not allowed in type expressions"
d: True, # error: [invalid-type-form] "Boolean literals are not allowed in this context in a type expression"
e: int | b"foo", # error: [invalid-type-form] "Bytes literals are not allowed in this context in a type expression"
# error: [unsupported-operator]
# error: [invalid-type-form] "Bytes literals are not allowed in this context in a type expression"
e: int | b"foo",
f: 1 and 2, # error: [invalid-type-form] "Boolean operations are not allowed in type expressions"
g: 1 or 2, # error: [invalid-type-form] "Boolean operations are not allowed in type expressions"
h: (foo := 1), # error: [invalid-type-form] "Named expressions are not allowed in type expressions"
Expand All @@ -97,7 +99,9 @@ async def outer_async(): # avoid unrelated syntax errors on `yield` and `await`
m: (yield 1), # error: [invalid-type-form] "`yield` expressions are not allowed in type expressions"
n: 1 < 2, # error: [invalid-type-form] "Comparison expressions are not allowed in type expressions"
o: bar(), # error: [invalid-type-form] "Function calls are not allowed in type expressions"
p: int | f"foo", # error: [invalid-type-form] "F-strings are not allowed in type expressions"
# error: [unsupported-operator]
# error: [invalid-type-form] "F-strings are not allowed in type expressions"
p: int | f"foo",
# error: [invalid-type-form] "Slices are not allowed in type expressions"
# error: [invalid-type-form] "Invalid subscript"
q: [1, 2, 3][1:2],
Expand Down
Loading
Loading