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
138 changes: 69 additions & 69 deletions crates/ty_ide/src/goto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,16 +421,16 @@ mod tests {
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:4:13
Expand All @@ -440,7 +440,7 @@ mod tests {
4 | a
| ^
|
"###);
"#);
}
#[test]
fn goto_type_of_expression_with_literal_node() {
Expand All @@ -450,24 +450,24 @@ mod tests {
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:2:22
|
2 | a: str = "test"
| ^^^^^^
|
"###);
"#);
}

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

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:4:18
Expand All @@ -585,7 +585,7 @@ mod tests {
4 | test(a= "123")
| ^
|
"###);
"#);
}

#[test]
Expand All @@ -601,16 +601,16 @@ mod tests {
// TODO: This should jump to `str` and not `int` because
// the keyword is typed as a string. It's only the passed argument that
// is an int. Navigating to `str` would match pyright's behavior.
assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:238:7
--> stdlib/builtins.pyi:244:7
|
236 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
237 |
238 | class int:
242 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
243 |
244 | class int:
| ^^^
239 | @overload
240 | def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
245 | @overload
246 | def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
|
info: Source
--> main.py:4:18
Expand All @@ -620,7 +620,7 @@ mod tests {
4 | test(a= 123)
| ^
|
"###);
");
}

#[test]
Expand All @@ -635,16 +635,16 @@ f(**kwargs<CURSOR>)
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:1096:7
--> stdlib/builtins.pyi:1136:7
|
1094 | def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
1095 |
1096 | class dict(MutableMapping[_KT, _VT]):
1134 | def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
1135 |
1136 | class dict(MutableMapping[_KT, _VT]):
| ^^^^
1097 | # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
1098 | # Also multiprocessing.managers.SyncManager.dict()
1137 | # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
1138 | # Also multiprocessing.managers.SyncManager.dict()
|
info: Source
--> main.py:6:5
Expand All @@ -654,7 +654,7 @@ f(**kwargs<CURSOR>)
6 | f(**kwargs)
| ^^^^^^
|
"###);
"#);
}

#[test]
Expand All @@ -666,16 +666,16 @@ f(**kwargs<CURSOR>)
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:3:17
Expand All @@ -684,7 +684,7 @@ f(**kwargs<CURSOR>)
3 | a
| ^
|
"###);
");
}

#[test]
Expand Down Expand Up @@ -759,16 +759,16 @@ f(**kwargs<CURSOR>)
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:4:27
Expand All @@ -778,7 +778,7 @@ f(**kwargs<CURSOR>)
4 | print(a)
| ^
|
"###);
");
}

#[test]
Expand All @@ -790,15 +790,15 @@ f(**kwargs<CURSOR>)
"#,
);

assert_snapshot!(test.goto_type_definition(), @r###"
assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/types.pyi:680:11
--> stdlib/types.pyi:689:11
|
678 | if sys.version_info >= (3, 10):
679 | @final
680 | class NoneType:
687 | if sys.version_info >= (3, 10):
688 | @final
689 | class NoneType:
| ^^^^^^^^
681 | def __bool__(self) -> Literal[False]: ...
690 | def __bool__(self) -> Literal[False]: ...
|
info: Source
--> main.py:3:17
Expand All @@ -809,14 +809,14 @@ f(**kwargs<CURSOR>)
|

info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:445:7
--> stdlib/builtins.pyi:461:7
|
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
444 |
445 | class str(Sequence[str]):
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
460 |
461 | class str(Sequence[str]):
| ^^^
446 | @overload
447 | def __new__(cls, object: object = ...) -> Self: ...
462 | @overload
463 | def __new__(cls, object: object = ...) -> Self: ...
|
info: Source
--> main.py:3:17
Expand All @@ -825,7 +825,7 @@ f(**kwargs<CURSOR>)
3 | a
| ^
|
"###);
");
}

impl CursorTest {
Expand Down
2 changes: 1 addition & 1 deletion crates/ty_vendored/vendor/typeshed/source_commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1063db7c15135c172f1f6a81d3aff6d1cb00a980
5a3c495d2f6fa9b68cd99f39feba4426e4d17ea9
5 changes: 5 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/_asyncio.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@ def _leave_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ...

if sys.version_info >= (3, 12):
def current_task(loop: AbstractEventLoop | None = None) -> Task[Any] | None: ...

if sys.version_info >= (3, 14):
def future_discard_from_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
def future_add_to_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
2 changes: 2 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class _CData:
_objects: Mapping[Any, int] | None
def __buffer__(self, flags: int, /) -> memoryview: ...
def __ctypes_from_outparam__(self, /) -> Self: ...
if sys.version_info >= (3, 14):
__pointer_type__: type

# this is a union of all the subclasses of _CData, which is useful because of
# the methods that are present on each of those subclasses which are not present
Expand Down
3 changes: 3 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def has_colors() -> bool: ...
if sys.version_info >= (3, 10):
def has_extended_color_support() -> bool: ...

if sys.version_info >= (3, 14):
def assume_default_colors(fg: int, bg: int, /) -> None: ...

def has_ic() -> bool: ...
def has_il() -> bool: ...
def has_key(key: int, /) -> bool: ...
Expand Down
12 changes: 10 additions & 2 deletions crates/ty_vendored/vendor/typeshed/stdlib/_heapq.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import sys
from typing import Any, Final, TypeVar

_T = TypeVar("_T")
_T = TypeVar("_T") # list items must be comparable

__about__: Final[str]

def heapify(heap: list[Any], /) -> None: ...
def heapify(heap: list[Any], /) -> None: ... # list items must be comparable
def heappop(heap: list[_T], /) -> _T: ...
def heappush(heap: list[_T], item: _T, /) -> None: ...
def heappushpop(heap: list[_T], item: _T, /) -> _T: ...
def heapreplace(heap: list[_T], item: _T, /) -> _T: ...

if sys.version_info >= (3, 14):
def heapify_max(heap: list[Any], /) -> None: ... # list items must be comparable
def heappop_max(heap: list[_T], /) -> _T: ...
def heappush_max(heap: list[_T], item: _T, /) -> None: ...
def heappushpop_max(heap: list[_T], item: _T, /) -> _T: ...
def heapreplace_max(heap: list[_T], item: _T, /) -> _T: ...
2 changes: 2 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/_imp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ from importlib.machinery import ModuleSpec
from typing import Any

check_hash_based_pycs: str
if sys.version_info >= (3, 14):
pyc_magic_number_token: int

def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
def create_builtin(spec: ModuleSpec, /) -> types.ModuleType: ...
Expand Down
Loading
Loading