diff --git a/crates/ty_ide/src/hover.rs b/crates/ty_ide/src/hover.rs index 2960b9da83..c192b87380 100644 --- a/crates/ty_ide/src/hover.rs +++ b/crates/ty_ide/src/hover.rs @@ -151,14 +151,19 @@ impl fmt::Display for DisplayHoverContent<'_, '_> { Some(TypeVarVariance::Bivariant) => " (bivariant)", None => "", }; + + // Special types like `` + // render poorly with python syntax-highlighting but well as xml + let ty_string = ty + .display_with(self.db, DisplaySettings::default().multiline()) + .to_string(); + let syntax = if ty_string.starts_with('<') { + "xml" + } else { + "python" + }; self.kind - .fenced_code_block( - format!( - "{}{variance}", - ty.display_with(self.db, DisplaySettings::default().multiline()) - ), - "python", - ) + .fenced_code_block(format!("{ty_string}{variance}"), syntax) .fmt(f) } HoverContent::Docstring(docstring) => docstring.render(self.kind).fmt(f), @@ -358,7 +363,7 @@ mod tests { Everyone loves my class!! --------------------------------------------- - ```python + ```xml ``` --- @@ -420,7 +425,7 @@ mod tests { Everyone loves my class!! --------------------------------------------- - ```python + ```xml ``` --- @@ -480,7 +485,7 @@ mod tests { initializes MyClass (perfectly) --------------------------------------------- - ```python + ```xml ``` --- @@ -536,7 +541,7 @@ mod tests { initializes MyClass (perfectly) --------------------------------------------- - ```python + ```xml ``` --- @@ -595,7 +600,7 @@ mod tests { Everyone loves my class!! --------------------------------------------- - ```python + ```xml ``` --- @@ -1680,7 +1685,7 @@ def ab(a: int, *, c: int): Wow this module rocks. --------------------------------------------- - ```python + ```xml ``` --- @@ -2029,7 +2034,7 @@ def function(): assert_snapshot!(test.hover(), @r" --------------------------------------------- - ```python + ```xml ``` --------------------------------------------- @@ -2234,7 +2239,7 @@ def function(): Wow this module rocks. --------------------------------------------- - ```python + ```xml ``` --- @@ -3343,7 +3348,7 @@ def function(): assert_snapshot!(test.hover(), @r" --------------------------------------------- - ```python + ```xml ``` --------------------------------------------- @@ -3385,7 +3390,7 @@ def function(): assert_snapshot!(test.hover(), @r" --------------------------------------------- - ```python + ```xml ``` --------------------------------------------- @@ -3469,7 +3474,7 @@ def function(): assert_snapshot!(test.hover(), @r" --------------------------------------------- - ```python + ```xml ``` --------------------------------------------- @@ -3510,7 +3515,7 @@ def function(): assert_snapshot!(test.hover(), @r" --------------------------------------------- - ```python + ```xml ``` --------------------------------------------- diff --git a/crates/ty_ide/src/inlay_hints.rs b/crates/ty_ide/src/inlay_hints.rs index a958b4451d..6d7d5c9094 100644 --- a/crates/ty_ide/src/inlay_hints.rs +++ b/crates/ty_ide/src/inlay_hints.rs @@ -6216,7 +6216,7 @@ mod tests { assert_snapshot!(test.inlay_hints(), @r#" from typing import Literal - a[: ] = Literal['a', 'b', 'c'] + a[: ] = Literal['a', 'b', 'c'] --------------------------------------------- info[inlay-hint-location]: Inlay Hint Target --> stdlib/typing.pyi:351:1 @@ -6232,7 +6232,7 @@ mod tests { | 2 | from typing import Literal 3 | - 4 | a[: ] = Literal['a', 'b', 'c'] + 4 | a[: ] = Literal['a', 'b', 'c'] | ^^^^^^^ | @@ -6250,7 +6250,7 @@ mod tests { | 2 | from typing import Literal 3 | - 4 | a[: ] = Literal['a', 'b', 'c'] + 4 | a[: ] = Literal['a', 'b', 'c'] | ^^^ | @@ -6268,7 +6268,7 @@ mod tests { | 2 | from typing import Literal 3 | - 4 | a[: ] = Literal['a', 'b', 'c'] + 4 | a[: ] = Literal['a', 'b', 'c'] | ^^^ | @@ -6286,7 +6286,7 @@ mod tests { | 2 | from typing import Literal 3 | - 4 | a[: ] = Literal['a', 'b', 'c'] + 4 | a[: ] = Literal['a', 'b', 'c'] | ^^^ | "#); @@ -6636,7 +6636,7 @@ mod tests { assert_snapshot!(test.inlay_hints(), @r" from typing import Protocol, TypeVar T = TypeVar([name=]'T') - Strange[: ] = Protocol[T] + Strange[: ] = Protocol[T] --------------------------------------------- info[inlay-hint-location]: Inlay Hint Target --> stdlib/typing.pyi:276:13 @@ -6654,7 +6654,7 @@ mod tests { 2 | from typing import Protocol, TypeVar 3 | T = TypeVar([name=]'T') | ^^^^ - 4 | Strange[: ] = Protocol[T] + 4 | Strange[: ] = Protocol[T] | info[inlay-hint-location]: Inlay Hint Target @@ -6671,7 +6671,7 @@ mod tests { | 2 | from typing import Protocol, TypeVar 3 | T = TypeVar([name=]'T') - 4 | Strange[: ] = Protocol[T] + 4 | Strange[: ] = Protocol[T] | ^^^^^^^^^^^^^^^ | @@ -6688,7 +6688,7 @@ mod tests { | 2 | from typing import Protocol, TypeVar 3 | T = TypeVar([name=]'T') - 4 | Strange[: ] = Protocol[T] + 4 | Strange[: ] = Protocol[T] | ^ | "); diff --git a/crates/ty_python_semantic/resources/mdtest/annotations/any.md b/crates/ty_python_semantic/resources/mdtest/annotations/any.md index 1bdc306112..eef66d6b74 100644 --- a/crates/ty_python_semantic/resources/mdtest/annotations/any.md +++ b/crates/ty_python_semantic/resources/mdtest/annotations/any.md @@ -169,13 +169,13 @@ def f(x: Any[int]): `Any` cannot be called (this leads to a `TypeError` at runtime): ```py -Any() # error: [call-non-callable] "Object of type `` is not callable" +Any() # error: [call-non-callable] "Object of type `` is not callable" ``` `Any` also cannot be used as a metaclass (under the hood, this leads to an implicit call to `Any`): ```py -class F(metaclass=Any): ... # error: [invalid-metaclass] "Metaclass type `` is not callable" +class F(metaclass=Any): ... # error: [invalid-metaclass] "Metaclass type `` is not callable" ``` And `Any` cannot be used in `isinstance()` checks: diff --git a/crates/ty_python_semantic/resources/mdtest/annotations/never.md b/crates/ty_python_semantic/resources/mdtest/annotations/never.md index 2cd7845771..62f0968d29 100644 --- a/crates/ty_python_semantic/resources/mdtest/annotations/never.md +++ b/crates/ty_python_semantic/resources/mdtest/annotations/never.md @@ -59,7 +59,7 @@ python-version = "3.11" ```py from typing import Never -reveal_type(Never) # revealed: +reveal_type(Never) # revealed: ``` ### Python 3.10 diff --git a/crates/ty_python_semantic/resources/mdtest/binary/classes.md b/crates/ty_python_semantic/resources/mdtest/binary/classes.md index e0da23bf50..26a7f664b2 100644 --- a/crates/ty_python_semantic/resources/mdtest/binary/classes.md +++ b/crates/ty_python_semantic/resources/mdtest/binary/classes.md @@ -13,7 +13,7 @@ python-version = "3.10" class A: ... class B: ... -reveal_type(A | B) # revealed: +reveal_type(A | B) # revealed: ``` ## Union of two classes (prior to 3.10) @@ -43,14 +43,14 @@ class A: ... class B: ... def _(sub_a: type[A], sub_b: type[B]): - reveal_type(A | sub_b) # revealed: - reveal_type(sub_a | B) # revealed: - reveal_type(sub_a | sub_b) # revealed: + reveal_type(A | sub_b) # revealed: + reveal_type(sub_a | B) # revealed: + reveal_type(sub_a | sub_b) # revealed: class C[T]: ... class D[T]: ... -reveal_type(C | D) # revealed: +reveal_type(C | D) # revealed: -reveal_type(C[int] | D[str]) # revealed: +reveal_type(C[int] | D[str]) # revealed: ``` diff --git a/crates/ty_python_semantic/resources/mdtest/class/super.md b/crates/ty_python_semantic/resources/mdtest/class/super.md index ab96e93ca5..61c24db75a 100644 --- a/crates/ty_python_semantic/resources/mdtest/class/super.md +++ b/crates/ty_python_semantic/resources/mdtest/class/super.md @@ -602,13 +602,13 @@ super(object, object()).__class__ # Not all objects valid in a class's bases list are valid as the first argument to `super()`. # For example, it's valid to inherit from `typing.ChainMap`, but it's not valid as the first argument to `super()`. # -# error: [invalid-super-argument] "`` is not a valid class" +# error: [invalid-super-argument] "`` is not a valid class" reveal_type(super(typing.ChainMap, collections.ChainMap())) # revealed: Unknown # Meanwhile, it's not valid to inherit from unsubscripted `typing.Generic`, # but it *is* valid as the first argument to `super()`. # -# revealed: , > +# revealed: , > reveal_type(super(typing.Generic, typing.SupportsInt)) def _(x: type[typing.Any], y: typing.Any): diff --git a/crates/ty_python_semantic/resources/mdtest/function/return_type.md b/crates/ty_python_semantic/resources/mdtest/function/return_type.md index 81ccb339e7..28bd509e44 100644 --- a/crates/ty_python_semantic/resources/mdtest/function/return_type.md +++ b/crates/ty_python_semantic/resources/mdtest/function/return_type.md @@ -80,7 +80,7 @@ class Foo(Protocol): def f[T](self, v: T) -> T: ... t = (Protocol, int) -reveal_type(t[0]) # revealed: +reveal_type(t[0]) # revealed: class Lorem(t[0]): def f(self) -> int: ... diff --git a/crates/ty_python_semantic/resources/mdtest/implicit_type_aliases.md b/crates/ty_python_semantic/resources/mdtest/implicit_type_aliases.md index ef6f07283f..cd4f6ff26e 100644 --- a/crates/ty_python_semantic/resources/mdtest/implicit_type_aliases.md +++ b/crates/ty_python_semantic/resources/mdtest/implicit_type_aliases.md @@ -77,44 +77,44 @@ IntOrTypeVar = int | T TypeVarOrNone = T | None NoneOrTypeVar = None | T -reveal_type(IntOrStr) # revealed: -reveal_type(IntOrStrOrBytes1) # revealed: -reveal_type(IntOrStrOrBytes2) # revealed: -reveal_type(IntOrStrOrBytes3) # revealed: -reveal_type(IntOrStrOrBytes4) # revealed: -reveal_type(IntOrStrOrBytes5) # revealed: -reveal_type(IntOrStrOrBytes6) # revealed: -reveal_type(BytesOrIntOrStr) # revealed: -reveal_type(IntOrNone) # revealed: -reveal_type(NoneOrInt) # revealed: -reveal_type(IntOrStrOrNone) # revealed: -reveal_type(NoneOrIntOrStr) # revealed: -reveal_type(IntOrAny) # revealed: -reveal_type(AnyOrInt) # revealed: -reveal_type(NoneOrAny) # revealed: -reveal_type(AnyOrNone) # revealed: -reveal_type(NeverOrAny) # revealed: -reveal_type(AnyOrNever) # revealed: -reveal_type(UnknownOrInt) # revealed: -reveal_type(IntOrUnknown) # revealed: -reveal_type(StrOrZero) # revealed: -reveal_type(ZeroOrStr) # revealed: -reveal_type(IntOrLiteralString) # revealed: -reveal_type(LiteralStringOrInt) # revealed: -reveal_type(NoneOrTuple) # revealed: -reveal_type(TupleOrNone) # revealed: -reveal_type(IntOrAnnotated) # revealed: -reveal_type(AnnotatedOrInt) # revealed: -reveal_type(IntOrOptional) # revealed: -reveal_type(OptionalOrInt) # revealed: -reveal_type(IntOrTypeOfStr) # revealed: -reveal_type(TypeOfStrOrInt) # revealed: -reveal_type(IntOrCallable) # revealed: bytes)'> -reveal_type(CallableOrInt) # revealed: bytes) | int'> -reveal_type(TypeVarOrInt) # revealed: -reveal_type(IntOrTypeVar) # revealed: -reveal_type(TypeVarOrNone) # revealed: -reveal_type(NoneOrTypeVar) # revealed: +reveal_type(IntOrStr) # revealed: +reveal_type(IntOrStrOrBytes1) # revealed: +reveal_type(IntOrStrOrBytes2) # revealed: +reveal_type(IntOrStrOrBytes3) # revealed: +reveal_type(IntOrStrOrBytes4) # revealed: +reveal_type(IntOrStrOrBytes5) # revealed: +reveal_type(IntOrStrOrBytes6) # revealed: +reveal_type(BytesOrIntOrStr) # revealed: +reveal_type(IntOrNone) # revealed: +reveal_type(NoneOrInt) # revealed: +reveal_type(IntOrStrOrNone) # revealed: +reveal_type(NoneOrIntOrStr) # revealed: +reveal_type(IntOrAny) # revealed: +reveal_type(AnyOrInt) # revealed: +reveal_type(NoneOrAny) # revealed: +reveal_type(AnyOrNone) # revealed: +reveal_type(NeverOrAny) # revealed: +reveal_type(AnyOrNever) # revealed: +reveal_type(UnknownOrInt) # revealed: +reveal_type(IntOrUnknown) # revealed: +reveal_type(StrOrZero) # revealed: +reveal_type(ZeroOrStr) # revealed: +reveal_type(IntOrLiteralString) # revealed: +reveal_type(LiteralStringOrInt) # revealed: +reveal_type(NoneOrTuple) # revealed: +reveal_type(TupleOrNone) # revealed: +reveal_type(IntOrAnnotated) # revealed: +reveal_type(AnnotatedOrInt) # revealed: +reveal_type(IntOrOptional) # revealed: +reveal_type(OptionalOrInt) # revealed: +reveal_type(IntOrTypeOfStr) # revealed: +reveal_type(TypeOfStrOrInt) # revealed: +reveal_type(IntOrCallable) # revealed: bytes)'> +reveal_type(CallableOrInt) # revealed: bytes) | int'> +reveal_type(TypeVarOrInt) # revealed: +reveal_type(IntOrTypeVar) # revealed: +reveal_type(TypeVarOrNone) # revealed: +reveal_type(NoneOrTypeVar) # revealed: def _( int_or_str: IntOrStr, @@ -295,7 +295,7 @@ X = Foo | Bar # In an ideal world, perhaps we would respect `Meta.__or__` here and reveal `str`? # But we still need to record what the elements are, since (according to the typing spec) # `X` is still a valid type alias -reveal_type(X) # revealed: +reveal_type(X) # revealed: def f(obj: X): reveal_type(obj) # revealed: Foo | Bar @@ -391,17 +391,17 @@ MyOptional = T | None reveal_type(MyList) # revealed: reveal_type(MyDict) # revealed: -reveal_type(MyType) # revealed: +reveal_type(MyType) # revealed: reveal_type(IntAndType) # revealed: reveal_type(Pair) # revealed: reveal_type(Sum) # revealed: -reveal_type(ListOrTuple) # revealed: -# revealed: +reveal_type(ListOrTuple) # revealed: +# revealed: reveal_type(ListOrTupleLegacy) -reveal_type(MyCallable) # revealed: T@MyCallable'> -reveal_type(AnnotatedType) # revealed: ]'> +reveal_type(MyCallable) # revealed: T@MyCallable'> +reveal_type(AnnotatedType) # revealed: ]'> reveal_type(TransparentAlias) # revealed: TypeVar -reveal_type(MyOptional) # revealed: +reveal_type(MyOptional) # revealed: def _( list_of_ints: MyList[int], @@ -457,13 +457,13 @@ AnnotatedInt = AnnotatedType[int] SubclassOfInt = MyType[int] CallableIntToStr = MyCallable[[int], str] -reveal_type(IntsOrNone) # revealed: -reveal_type(IntsOrStrs) # revealed: +reveal_type(IntsOrNone) # revealed: +reveal_type(IntsOrStrs) # revealed: reveal_type(ListOfPairs) # revealed: -reveal_type(ListOrTupleOfInts) # revealed: -reveal_type(AnnotatedInt) # revealed: ]'> -reveal_type(SubclassOfInt) # revealed: -reveal_type(CallableIntToStr) # revealed: str'> +reveal_type(ListOrTupleOfInts) # revealed: +reveal_type(AnnotatedInt) # revealed: ]'> +reveal_type(SubclassOfInt) # revealed: +reveal_type(CallableIntToStr) # revealed: str'> def _( ints_or_none: IntsOrNone, @@ -495,8 +495,8 @@ MyOtherType = MyType[T] TypeOrList = MyType[B] | MyList[B] reveal_type(MyOtherList) # revealed: -reveal_type(MyOtherType) # revealed: -reveal_type(TypeOrList) # revealed: +reveal_type(MyOtherType) # revealed: +reveal_type(TypeOrList) # revealed: def _( list_of_ints: MyOtherList[int], @@ -730,7 +730,7 @@ def _(doubly_specialized: DictInt[int]): Union = list[str] | list[int] -# error: [non-subscriptable] "Cannot subscript non-generic type: `` is already specialized" +# error: [non-subscriptable] "Cannot subscript non-generic type: `` is already specialized" def _(doubly_specialized: Union[int]): reveal_type(doubly_specialized) # revealed: Unknown @@ -974,7 +974,7 @@ from typing import Optional MyOptionalInt = Optional[int] -reveal_type(MyOptionalInt) # revealed: +reveal_type(MyOptionalInt) # revealed: def _(optional_int: MyOptionalInt): reveal_type(optional_int) # revealed: int | None @@ -1007,9 +1007,9 @@ MyLiteralString = LiteralString MyNoReturn = NoReturn MyNever = Never -reveal_type(MyLiteralString) # revealed: -reveal_type(MyNoReturn) # revealed: -reveal_type(MyNever) # revealed: +reveal_type(MyLiteralString) # revealed: +reveal_type(MyNoReturn) # revealed: +reveal_type(MyNever) # revealed: def _( ls: MyLiteralString, @@ -1062,8 +1062,8 @@ from typing import Union IntOrStr = Union[int, str] IntOrStrOrBytes = Union[int, Union[str, bytes]] -reveal_type(IntOrStr) # revealed: -reveal_type(IntOrStrOrBytes) # revealed: +reveal_type(IntOrStr) # revealed: +reveal_type(IntOrStrOrBytes) # revealed: def _( int_or_str: IntOrStr, @@ -1091,7 +1091,7 @@ An empty `typing.Union` leads to a `TypeError` at runtime, so we emit an error. # error: [invalid-type-form] "`typing.Union` requires at least one type argument" EmptyUnion = Union[()] -reveal_type(EmptyUnion) # revealed: +reveal_type(EmptyUnion) # revealed: def _(empty: EmptyUnion): reveal_type(empty) # revealed: Never @@ -1136,14 +1136,14 @@ SubclassOfG = type[G] SubclassOfGInt = type[G[int]] SubclassOfP = type[P] -reveal_type(SubclassOfA) # revealed: -reveal_type(SubclassOfAny) # revealed: -reveal_type(SubclassOfAOrB1) # revealed: -reveal_type(SubclassOfAOrB2) # revealed: -reveal_type(SubclassOfAOrB3) # revealed: -reveal_type(SubclassOfG) # revealed: -reveal_type(SubclassOfGInt) # revealed: -reveal_type(SubclassOfP) # revealed: +reveal_type(SubclassOfA) # revealed: +reveal_type(SubclassOfAny) # revealed: +reveal_type(SubclassOfAOrB1) # revealed: +reveal_type(SubclassOfAOrB2) # revealed: +reveal_type(SubclassOfAOrB3) # revealed: +reveal_type(SubclassOfG) # revealed: +reveal_type(SubclassOfGInt) # revealed: +reveal_type(SubclassOfP) # revealed: def _( subclass_of_a: SubclassOfA, @@ -1224,14 +1224,14 @@ SubclassOfG = Type[G] SubclassOfGInt = Type[G[int]] SubclassOfP = Type[P] -reveal_type(SubclassOfA) # revealed: -reveal_type(SubclassOfAny) # revealed: -reveal_type(SubclassOfAOrB1) # revealed: -reveal_type(SubclassOfAOrB2) # revealed: -reveal_type(SubclassOfAOrB3) # revealed: -reveal_type(SubclassOfG) # revealed: -reveal_type(SubclassOfGInt) # revealed: -reveal_type(SubclassOfP) # revealed: +reveal_type(SubclassOfA) # revealed: +reveal_type(SubclassOfAny) # revealed: +reveal_type(SubclassOfAOrB1) # revealed: +reveal_type(SubclassOfAOrB2) # revealed: +reveal_type(SubclassOfAOrB3) # revealed: +reveal_type(SubclassOfG) # revealed: +reveal_type(SubclassOfGInt) # revealed: +reveal_type(SubclassOfP) # revealed: def _( subclass_of_a: SubclassOfA, @@ -1346,25 +1346,25 @@ DefaultDictOrNone = DefaultDict[str, int] | None DequeOrNone = Deque[str] | None OrderedDictOrNone = OrderedDict[str, int] | None -reveal_type(NoneOrList) # revealed: -reveal_type(NoneOrSet) # revealed: -reveal_type(NoneOrDict) # revealed: -reveal_type(NoneOrFrozenSet) # revealed: -reveal_type(NoneOrChainMap) # revealed: -reveal_type(NoneOrCounter) # revealed: -reveal_type(NoneOrDefaultDict) # revealed: -reveal_type(NoneOrDeque) # revealed: -reveal_type(NoneOrOrderedDict) # revealed: +reveal_type(NoneOrList) # revealed: +reveal_type(NoneOrSet) # revealed: +reveal_type(NoneOrDict) # revealed: +reveal_type(NoneOrFrozenSet) # revealed: +reveal_type(NoneOrChainMap) # revealed: +reveal_type(NoneOrCounter) # revealed: +reveal_type(NoneOrDefaultDict) # revealed: +reveal_type(NoneOrDeque) # revealed: +reveal_type(NoneOrOrderedDict) # revealed: -reveal_type(ListOrNone) # revealed: -reveal_type(SetOrNone) # revealed: -reveal_type(DictOrNone) # revealed: -reveal_type(FrozenSetOrNone) # revealed: -reveal_type(ChainMapOrNone) # revealed: -reveal_type(CounterOrNone) # revealed: -reveal_type(DefaultDictOrNone) # revealed: -reveal_type(DequeOrNone) # revealed: -reveal_type(OrderedDictOrNone) # revealed: +reveal_type(ListOrNone) # revealed: +reveal_type(SetOrNone) # revealed: +reveal_type(DictOrNone) # revealed: +reveal_type(FrozenSetOrNone) # revealed: +reveal_type(ChainMapOrNone) # revealed: +reveal_type(CounterOrNone) # revealed: +reveal_type(DefaultDictOrNone) # revealed: +reveal_type(DequeOrNone) # revealed: +reveal_type(OrderedDictOrNone) # revealed: def _( none_or_list: NoneOrList, @@ -1457,9 +1457,9 @@ CallableNoArgs = Callable[[], None] BasicCallable = Callable[[int, str], bytes] GradualCallable = Callable[..., str] -reveal_type(CallableNoArgs) # revealed: None'> -reveal_type(BasicCallable) # revealed: bytes'> -reveal_type(GradualCallable) # revealed: str'> +reveal_type(CallableNoArgs) # revealed: None'> +reveal_type(BasicCallable) # revealed: bytes'> +reveal_type(GradualCallable) # revealed: str'> def _( callable_no_args: CallableNoArgs, @@ -1491,8 +1491,8 @@ InvalidCallable1 = Callable[[int]] # error: [invalid-type-form] "The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`" InvalidCallable2 = Callable[int, str] -reveal_type(InvalidCallable1) # revealed: Unknown'> -reveal_type(InvalidCallable2) # revealed: Unknown'> +reveal_type(InvalidCallable1) # revealed: Unknown'> +reveal_type(InvalidCallable2) # revealed: Unknown'> def _(invalid_callable1: InvalidCallable1, invalid_callable2: InvalidCallable2): reveal_type(invalid_callable1) # revealed: (...) -> Unknown diff --git a/crates/ty_python_semantic/resources/mdtest/import/conventions.md b/crates/ty_python_semantic/resources/mdtest/import/conventions.md index 28ea0b4bc2..d2ec8320d5 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/conventions.md +++ b/crates/ty_python_semantic/resources/mdtest/import/conventions.md @@ -53,8 +53,8 @@ in `import os.path as os.path` the `os.path` is not a valid identifier. ```py from b import Any, Literal, foo -reveal_type(Any) # revealed: -reveal_type(Literal) # revealed: +reveal_type(Any) # revealed: +reveal_type(Literal) # revealed: reveal_type(foo) # revealed: ``` @@ -132,7 +132,7 @@ reveal_type(Any) # revealed: Unknown ```pyi from typing import Any -reveal_type(Any) # revealed: +reveal_type(Any) # revealed: ``` ## Nested mixed re-export and not @@ -169,7 +169,7 @@ reveal_type(Any) # revealed: Unknown ```pyi from typing import Any -reveal_type(Any) # revealed: +reveal_type(Any) # revealed: ``` ## Exported as different name diff --git a/crates/ty_python_semantic/resources/mdtest/import/star.md b/crates/ty_python_semantic/resources/mdtest/import/star.md index a60c0062b1..72c2a97e49 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/star.md +++ b/crates/ty_python_semantic/resources/mdtest/import/star.md @@ -1437,7 +1437,7 @@ are present due to `*` imports. import collections.abc reveal_type(collections.abc.Sequence) # revealed: -reveal_type(collections.abc.Callable) # revealed: +reveal_type(collections.abc.Callable) # revealed: reveal_type(collections.abc.Set) # revealed: ``` diff --git a/crates/ty_python_semantic/resources/mdtest/mro.md b/crates/ty_python_semantic/resources/mdtest/mro.md index da57d7f9a7..72e2360269 100644 --- a/crates/ty_python_semantic/resources/mdtest/mro.md +++ b/crates/ty_python_semantic/resources/mdtest/mro.md @@ -301,7 +301,7 @@ class B: ... EitherOr = A | B -# error: [invalid-base] "Invalid class base with type ``" +# error: [invalid-base] "Invalid class base with type ``" class Foo(EitherOr): ... ``` diff --git a/crates/ty_python_semantic/resources/mdtest/narrow/isinstance.md b/crates/ty_python_semantic/resources/mdtest/narrow/isinstance.md index 68562e06ad..4a78fd8982 100644 --- a/crates/ty_python_semantic/resources/mdtest/narrow/isinstance.md +++ b/crates/ty_python_semantic/resources/mdtest/narrow/isinstance.md @@ -156,7 +156,7 @@ from typing import Union IntOrStr = Union[int, str] -reveal_type(IntOrStr) # revealed: +reveal_type(IntOrStr) # revealed: def _(x: int | str | bytes | memoryview | range): if isinstance(x, IntOrStr): diff --git a/crates/ty_python_semantic/resources/mdtest/narrow/issubclass.md b/crates/ty_python_semantic/resources/mdtest/narrow/issubclass.md index 6c45c19ef2..d07dee6a22 100644 --- a/crates/ty_python_semantic/resources/mdtest/narrow/issubclass.md +++ b/crates/ty_python_semantic/resources/mdtest/narrow/issubclass.md @@ -209,7 +209,7 @@ from typing import Union IntOrStr = Union[int, str] -reveal_type(IntOrStr) # revealed: +reveal_type(IntOrStr) # revealed: def f(x: type[int | str | bytes | range]): if issubclass(x, IntOrStr): diff --git a/crates/ty_python_semantic/resources/mdtest/pep613_type_aliases.md b/crates/ty_python_semantic/resources/mdtest/pep613_type_aliases.md index 69f92dda94..29b13ee4b3 100644 --- a/crates/ty_python_semantic/resources/mdtest/pep613_type_aliases.md +++ b/crates/ty_python_semantic/resources/mdtest/pep613_type_aliases.md @@ -113,7 +113,7 @@ MyList: TypeAlias = list[T] ListOrSet: TypeAlias = list[T] | set[T] reveal_type(MyList) # revealed: -reveal_type(ListOrSet) # revealed: +reveal_type(ListOrSet) # revealed: def _(list_of_int: MyList[int], list_or_set_of_str: ListOrSet[str]): reveal_type(list_of_int) # revealed: list[int] @@ -293,7 +293,7 @@ def _(rec: RecursiveHomogeneousTuple): reveal_type(rec) # revealed: tuple[Divergent, ...] ClassInfo: TypeAlias = type | UnionType | tuple["ClassInfo", ...] -reveal_type(ClassInfo) # revealed: +reveal_type(ClassInfo) # revealed: def my_isinstance(obj: object, classinfo: ClassInfo) -> bool: # TODO should be `type | UnionType | tuple[ClassInfo, ...]` diff --git a/crates/ty_python_semantic/resources/mdtest/snapshots/isinstance.md_-_Narrowing_for_`isins…_-_`classinfo`_is_an_in…_(eeef56c0ef87a30b).snap b/crates/ty_python_semantic/resources/mdtest/snapshots/isinstance.md_-_Narrowing_for_`isins…_-_`classinfo`_is_an_in…_(eeef56c0ef87a30b).snap index 195610b255..9258e5b40c 100644 --- a/crates/ty_python_semantic/resources/mdtest/snapshots/isinstance.md_-_Narrowing_for_`isins…_-_`classinfo`_is_an_in…_(eeef56c0ef87a30b).snap +++ b/crates/ty_python_semantic/resources/mdtest/snapshots/isinstance.md_-_Narrowing_for_`isins…_-_`classinfo`_is_an_in…_(eeef56c0ef87a30b).snap @@ -63,7 +63,7 @@ error[invalid-argument-type]: Invalid second argument to `isinstance` 10 | # error: [invalid-argument-type] | info: A `UnionType` instance can only be used as the second argument to `isinstance` if all elements are class objects -info: Elements `` and `` in the union are not class objects +info: Elements `` and `` in the union are not class objects info: rule `invalid-argument-type` is enabled by default ``` @@ -82,7 +82,7 @@ error[invalid-argument-type]: Invalid second argument to `isinstance` 13 | else: | info: A `UnionType` instance can only be used as the second argument to `isinstance` if all elements are class objects -info: Element `` in the union, and 2 more elements, are not class objects +info: Element `` in the union, and 2 more elements, are not class objects info: rule `invalid-argument-type` is enabled by default ``` diff --git a/crates/ty_python_semantic/resources/mdtest/snapshots/mro.md_-_Method_Resolution_Or…_-_Unresolvable_MROs_in…_(e2b355c09a967862).snap b/crates/ty_python_semantic/resources/mdtest/snapshots/mro.md_-_Method_Resolution_Or…_-_Unresolvable_MROs_in…_(e2b355c09a967862).snap index 42e41b6e87..f460099a95 100644 --- a/crates/ty_python_semantic/resources/mdtest/snapshots/mro.md_-_Method_Resolution_Or…_-_Unresolvable_MROs_in…_(e2b355c09a967862).snap +++ b/crates/ty_python_semantic/resources/mdtest/snapshots/mro.md_-_Method_Resolution_Or…_-_Unresolvable_MROs_in…_(e2b355c09a967862).snap @@ -24,7 +24,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/mro.md # Diagnostics ``` -error[inconsistent-mro]: Cannot create a consistent method resolution order (MRO) for class `Baz` with bases list `[, , ]` +error[inconsistent-mro]: Cannot create a consistent method resolution order (MRO) for class `Baz` with bases list `[, , ]` --> src/mdtest_snippet.py:7:1 | 5 | class Foo(Protocol): ... diff --git a/crates/ty_python_semantic/resources/mdtest/snapshots/protocols.md_-_Protocols_-_Calls_to_protocol_cl…_(288988036f34ddcf).snap b/crates/ty_python_semantic/resources/mdtest/snapshots/protocols.md_-_Protocols_-_Calls_to_protocol_cl…_(288988036f34ddcf).snap index 57bedf5797..60ff7043ab 100644 --- a/crates/ty_python_semantic/resources/mdtest/snapshots/protocols.md_-_Protocols_-_Calls_to_protocol_cl…_(288988036f34ddcf).snap +++ b/crates/ty_python_semantic/resources/mdtest/snapshots/protocols.md_-_Protocols_-_Calls_to_protocol_cl…_(288988036f34ddcf).snap @@ -42,7 +42,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/protocols.md # Diagnostics ``` -error[call-non-callable]: Object of type `` is not callable +error[call-non-callable]: Object of type `` is not callable --> src/mdtest_snippet.py:4:13 | 3 | # error: [call-non-callable] diff --git a/crates/ty_python_semantic/src/types/display.rs b/crates/ty_python_semantic/src/types/display.rs index 790fcc404f..885c9cb7f0 100644 --- a/crates/ty_python_semantic/src/types/display.rs +++ b/crates/ty_python_semantic/src/types/display.rs @@ -709,7 +709,7 @@ impl<'db> FmtDetailed<'db> for DisplayRepresentation<'db> { }, Type::SpecialForm(special_form) => { f.set_invalid_syntax(); - write!(f.with_type(self.ty), "") + write!(f.with_type(self.ty), "") } Type::KnownInstance(known_instance) => known_instance .display_with(self.db, self.settings.clone()) @@ -2334,7 +2334,7 @@ impl<'db> FmtDetailed<'db> for DisplayKnownInstanceRepr<'db> { match self.known_instance { KnownInstanceType::SubscriptedProtocol(generic_context) => { f.set_invalid_syntax(); - f.write_str(" FmtDetailed<'db> for DisplayKnownInstanceRepr<'db> { } KnownInstanceType::SubscriptedGeneric(generic_context) => { f.set_invalid_syntax(); - f.write_str(" FmtDetailed<'db> for DisplayKnownInstanceRepr<'db> { f.write_char('<')?; f.with_type(KnownClass::UnionType.to_class_literal(self.db)) .write_str("types.UnionType")?; - f.write_str(" special form")?; + f.write_str(" special-form")?; if let Ok(ty) = union.union_type(self.db) { f.write_str(" '")?; ty.display(self.db).fmt_detailed(f)?; @@ -2408,13 +2408,13 @@ impl<'db> FmtDetailed<'db> for DisplayKnownInstanceRepr<'db> { } KnownInstanceType::Literal(inner) => { f.set_invalid_syntax(); - f.write_str("") } KnownInstanceType::Annotated(inner) => { f.set_invalid_syntax(); - f.write_str(" FmtDetailed<'db> for DisplayKnownInstanceRepr<'db> { f.write_char('<')?; f.with_type(Type::SpecialForm(SpecialFormType::Callable)) .write_str("typing.Callable")?; - f.write_str(" special form '")?; + f.write_str(" special-form '")?; callable.display(self.db).fmt_detailed(f)?; f.write_str("'>") } KnownInstanceType::TypeGenericAlias(inner) => { f.set_invalid_syntax(); - f.write_str(""; expected "_ClassInfo" [arg-type] +discord/ext/commands/converter.py:1280: error: Argument 2 to "issubclass" has incompatible type ""; expected "_ClassInfo" [arg-type] discord/ext/commands/converter.py:1413: error: Need type annotation for "conversions" (hint: "conversions: Dict[, ] = ...") [var-annotated] discord/ext/commands/parameters.py:63: error: Parameter 1 of Literal[...] is invalid [valid-type] discord/ext/commands/parameters.py:64: error: Parameter 1 of Literal[...] is invalid [valid-type] diff --git a/scripts/ty_benchmark/snapshots/discord.py_ty.txt b/scripts/ty_benchmark/snapshots/discord.py_ty.txt index a260ef52e2..fab6a2f6af 100644 --- a/scripts/ty_benchmark/snapshots/discord.py_ty.txt +++ b/scripts/ty_benchmark/snapshots/discord.py_ty.txt @@ -123,8 +123,8 @@ discord/ext/commands/bot.py:330:50: error[invalid-type-arguments] Too many type discord/ext/commands/bot.py:655:16: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Any]` has no attribute `__name__` discord/ext/commands/bot.py:681:16: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Any]` has no attribute `__name__` discord/ext/commands/bot.py:1546:13: error[invalid-parameter-default] Default value of type `_DefaultRepr` is not assignable to annotated parameter type `HelpCommand | None` -discord/ext/commands/cog.py:288:36: error[invalid-type-arguments] Type `` is not assignable to upper bound `Cog | None` of type variable `CogT@Command` -discord/ext/commands/cog.py:289:79: error[invalid-type-arguments] Type `` is not assignable to upper bound `Group | Cog` of type variable `GroupT@Command` +discord/ext/commands/cog.py:288:36: error[invalid-type-arguments] Type `` is not assignable to upper bound `Cog | None` of type variable `CogT@Command` +discord/ext/commands/cog.py:289:79: error[invalid-type-arguments] Type `` is not assignable to upper bound `Group | Cog` of type variable `GroupT@Command` discord/ext/commands/context.py:411:15: error[invalid-method-override] Invalid override of method `_get_channel`: Definition is incompatible with `Messageable._get_channel` discord/ext/commands/context.py:783:9: error[invalid-method-override] Invalid override of method `typing`: Definition is incompatible with `Messageable.typing` discord/ext/commands/converter.py:402:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `TextChannel | VoiceChannel | StageChannel | ... omitted 4 union elements`, found `(VoiceChannel & ~AlwaysFalsy) | (StageChannel & ~AlwaysFalsy) | (ForumChannel & Messageable & ~AlwaysFalsy) | ... omitted 5 union elements` @@ -312,7 +312,7 @@ discord/sticker.py:434:16: warning[possibly-missing-attribute] Attribute `_get_g discord/sticker.py:489:43: warning[possibly-missing-attribute] Attribute `http` may be missing on object of type `Any | None | ConnectionState[Client]` discord/sticker.py:490:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ConnectionState[Client]`, found `Any | None | ConnectionState[Client]` discord/sticker.py:511:15: warning[possibly-missing-attribute] Attribute `http` may be missing on object of type `Any | None | ConnectionState[Client]` -discord/ui/action_row.py:122:67: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView | ActionRow[Unknown] | Container[Unknown]` of type variable `C@ContainedItemCallbackType` +discord/ui/action_row.py:122:67: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView | ActionRow[Unknown] | Container[Unknown]` of type variable `C@ContainedItemCallbackType` discord/ui/action_row.py:163:26: error[unresolved-attribute] Object of type `(Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]` has no attribute `__discord_ui_model_type__` discord/ui/action_row.py:163:59: error[unresolved-attribute] Object of type `(Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]` has no attribute `__discord_ui_model_kwargs__` discord/ui/action_row.py:166:27: error[unresolved-attribute] Object of type `(Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]` has no attribute `__name__` @@ -328,7 +328,7 @@ discord/ui/button.py:276:9: error[invalid-method-override] Invalid override of m discord/ui/button.py:287:9: error[invalid-method-override] Invalid override of method `_refresh_component`: Definition is incompatible with `Item._refresh_component` discord/ui/button.py:376:9: error[unresolved-attribute] Unresolved attribute `__discord_ui_model_type__` on type `(S@button, Interaction[Any], Button[V@button], /) -> Coroutine[Any, Any, Any]`. discord/ui/button.py:377:9: error[unresolved-attribute] Unresolved attribute `__discord_ui_model_kwargs__` on type `(S@button, Interaction[Any], Button[V@button], /) -> Coroutine[Any, Any, Any]`. -discord/ui/container.py:109:77: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView | ActionRow[Unknown] | Container[Unknown]` of type variable `C@ContainedItemCallbackType` +discord/ui/container.py:109:77: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView | ActionRow[Unknown] | Container[Unknown]` of type variable `C@ContainedItemCallbackType` discord/ui/container.py:151:30: error[unresolved-attribute] Object of type `((Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]) & ~Item[object]` has no attribute `__discord_ui_model_type__` discord/ui/container.py:151:62: error[unresolved-attribute] Object of type `((Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]) & ~Item[object]` has no attribute `__discord_ui_model_kwargs__` discord/ui/container.py:153:31: error[unresolved-attribute] Object of type `((Unknown, Interaction[Any], Unknown, /) -> Coroutine[Any, Any, Any]) & ~Item[object]` has no attribute `__name__` @@ -343,7 +343,7 @@ discord/ui/file_upload.py:184:9: error[invalid-method-override] Invalid override discord/ui/label.py:112:9: error[invalid-method-override] Invalid override of method `to_component_dict`: Definition is incompatible with `Item.to_component_dict` discord/ui/label.py:125:9: error[invalid-method-override] Invalid override of method `from_component`: Definition is incompatible with `Item.from_component` discord/ui/media_gallery.py:259:9: error[invalid-method-override] Invalid override of method `from_component`: Definition is incompatible with `Item.from_component` -discord/ui/modal.py:109:55: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView` of type variable `V@Item` +discord/ui/modal.py:109:55: error[invalid-type-arguments] Type `` is not assignable to upper bound `BaseView` of type variable `V@Item` discord/ui/modal.py:159:15: error[invalid-method-override] Invalid override of method `on_error`: Definition is incompatible with `BaseView.on_error` discord/ui/modal.py:176:9: error[invalid-method-override] Invalid override of method `_refresh`: Definition is incompatible with `BaseView._refresh` discord/ui/modal.py:202:15: error[invalid-method-override] Invalid override of method `_scheduled_task`: Definition is incompatible with `BaseView._scheduled_task` diff --git a/scripts/ty_benchmark/snapshots/homeassistant_ty.txt b/scripts/ty_benchmark/snapshots/homeassistant_ty.txt index dd80795364..3aa62a9d87 100644 --- a/scripts/ty_benchmark/snapshots/homeassistant_ty.txt +++ b/scripts/ty_benchmark/snapshots/homeassistant_ty.txt @@ -3060,8 +3060,8 @@ homeassistant/components/rfxtrx/switch.py:149:36: error[unresolved-attribute] Ob homeassistant/components/ring/camera.py:186:17: error[invalid-argument-type] Argument to function `async_aiohttp_proxy_stream` is incorrect: Expected `StreamReader`, found `StreamReader` homeassistant/components/ring/entity.py:79:54: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@exception_wrap]` has no attribute `__name__` homeassistant/components/ring/entity.py:190:16: error[invalid-return-type] Return type does not match returned value: expected `RingDevices`, found `Unknown | RingDevices | dict[str, Any]` -homeassistant/components/ring/switch.py:103:38: error[invalid-argument-type] Argument is incorrect: Expected ``, found `RingSwitchEntityDescription[Any]` -homeassistant/components/ring/switch.py:124:57: error[invalid-argument-type] Argument is incorrect: Expected ``, found `RingSwitchEntityDescription[RingDeviceT@RingSwitch]` +homeassistant/components/ring/switch.py:103:38: error[invalid-argument-type] Argument is incorrect: Expected ``, found `RingSwitchEntityDescription[Any]` +homeassistant/components/ring/switch.py:124:57: error[invalid-argument-type] Argument is incorrect: Expected ``, found `RingSwitchEntityDescription[RingDeviceT@RingSwitch]` homeassistant/components/ripple/sensor.py:7:6: error[unresolved-import] Cannot resolve imported module `pyripple` homeassistant/components/risco/config_flow.py:272:51: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method homeassistant/components/risco/config_flow.py:294:32: warning[possibly-missing-attribute] Attribute `values` may be missing on object of type `Unknown | int | dict[Unknown | str, Unknown | AlarmControlPanelState] | dict[Unknown | AlarmControlPanelState, Unknown | str]` @@ -4122,8 +4122,8 @@ homeassistant/components/yeelight/device.py:200:9: error[invalid-assignment] Obj homeassistant/components/yeelight/light.py:256:47: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@_async_cmd]` has no attribute `__name__` homeassistant/components/yeelight/light.py:264:43: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@_async_cmd]` has no attribute `__name__` homeassistant/components/yeelight/light.py:270:43: error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@_async_cmd]` has no attribute `__name__` -homeassistant/components/yeelight/scanner.py:55:13: error[invalid-assignment] Object of type `Self@async_get` is not assignable to attribute `_scanner` of type ` | None` -homeassistant/components/yeelight/scanner.py:56:16: error[invalid-return-type] Return type does not match returned value: expected `Self@async_get`, found ` | None` +homeassistant/components/yeelight/scanner.py:55:13: error[invalid-assignment] Object of type `Self@async_get` is not assignable to attribute `_scanner` of type ` | None` +homeassistant/components/yeelight/scanner.py:56:16: error[invalid-return-type] Return type does not match returned value: expected `Self@async_get`, found ` | None` homeassistant/components/yeelightsunflower/light.py:9:8: error[unresolved-import] Cannot resolve imported module `yeelightsunflower` homeassistant/components/yi/camera.py:7:6: error[unresolved-import] Cannot resolve imported module `aioftp` homeassistant/components/yi/camera.py:144:34: error[invalid-argument-type] Argument to bound method `open_camera` is incorrect: Expected `str`, found `Unknown | None` diff --git a/scripts/ty_benchmark/snapshots/pytorch_ty.txt b/scripts/ty_benchmark/snapshots/pytorch_ty.txt index e4742326a4..38c25f169a 100644 --- a/scripts/ty_benchmark/snapshots/pytorch_ty.txt +++ b/scripts/ty_benchmark/snapshots/pytorch_ty.txt @@ -8230,10 +8230,10 @@ torch/_library/infer_schema.py:63:18: error[unresolved-attribute] Object of type torch/_library/infer_schema.py:132:37: error[unresolved-attribute] Module `torch._C` has no member `ScriptObject` torch/_library/infer_schema.py:185:50: error[unresolved-attribute] Module `torch` has no member `device` torch/_library/infer_schema.py:187:44: error[unresolved-attribute] Module `torch` has no member `dtype` -torch/_library/infer_schema.py:222:80: error[invalid-assignment] Object of type `list[tuple[type | _SpecialForm | GenericAlias, str] | tuple[, str]]` is not assignable to `list[tuple[type | _SpecialForm | GenericAlias, str]]` -torch/_library/infer_schema.py:244:46: error[invalid-argument-type] Argument to function `derived_seq_types` is incorrect: Expected `type | _SpecialForm`, found `` -torch/_library/infer_schema.py:248:13: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[tuple[type | _SpecialForm | GenericAlias, str]]`, found `GeneratorType[tuple[, str], None, None]` -torch/_library/infer_schema.py:256:82: error[invalid-assignment] Object of type `list[tuple[type | _SpecialForm, str, bool, bool, bool] | tuple[, str, bool, bool, bool] | tuple[, str, bool, bool, bool]]` is not assignable to `list[tuple[type | _SpecialForm, str, bool, bool, bool]]` +torch/_library/infer_schema.py:222:80: error[invalid-assignment] Object of type `list[tuple[type | _SpecialForm | GenericAlias, str] | tuple[, str]]` is not assignable to `list[tuple[type | _SpecialForm | GenericAlias, str]]` +torch/_library/infer_schema.py:244:46: error[invalid-argument-type] Argument to function `derived_seq_types` is incorrect: Expected `type | _SpecialForm`, found `` +torch/_library/infer_schema.py:248:13: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[tuple[type | _SpecialForm | GenericAlias, str]]`, found `GeneratorType[tuple[, str], None, None]` +torch/_library/infer_schema.py:256:82: error[invalid-assignment] Object of type `list[tuple[type | _SpecialForm, str, bool, bool, bool] | tuple[, str, bool, bool, bool] | tuple[, str, bool, bool, bool]]` is not assignable to `list[tuple[type | _SpecialForm, str, bool, bool, bool]]` torch/_library/opaque_object.py:23:36: error[unresolved-attribute] Module `torch._C` has no member `ScriptObject` torch/_library/opaque_object.py:26:41: error[unresolved-attribute] Module `torch._C` has no member `ScriptObject` torch/_library/opaque_object.py:84:12: error[unresolved-attribute] Module `torch._C` has no member `_make_opaque_object` @@ -24835,14 +24835,14 @@ torch/utils/_pytree.py:1119:30: error[unresolved-attribute] Special form `typing torch/utils/_pytree.py:1120:31: error[unresolved-attribute] Special form `typing.Self` has no attribute `num_leaves` torch/utils/_pytree.py:1131:62: error[too-many-positional-arguments] Too many positional arguments to bound method `__repr__`: expected 1, got 2 torch/utils/_pytree.py:1135:58: error[too-many-positional-arguments] Too many positional arguments to bound method `__repr__`: expected 1, got 2 -torch/utils/_pytree.py:1167:16: error[invalid-return-type] Return type does not match returned value: expected `list[Self@children_specs]`, found `list[]` -torch/utils/_pytree.py:1173:16: error[invalid-return-type] Return type does not match returned value: expected `list[Self@children]`, found `list[]` -torch/utils/_pytree.py:1176:16: error[invalid-return-type] Return type does not match returned value: expected `Self@child`, found `` +torch/utils/_pytree.py:1167:16: error[invalid-return-type] Return type does not match returned value: expected `list[Self@children_specs]`, found `list[]` +torch/utils/_pytree.py:1173:16: error[invalid-return-type] Return type does not match returned value: expected `list[Self@children]`, found `list[]` +torch/utils/_pytree.py:1176:16: error[invalid-return-type] Return type does not match returned value: expected `Self@child`, found `` torch/utils/_pytree.py:1280:20: error[unresolved-attribute] Special form `typing.Self` has no attribute `num_leaves` torch/utils/_pytree.py:1281:34: error[unresolved-attribute] Special form `typing.Self` has no attribute `unflatten` torch/utils/_pytree.py:1341:18: warning[deprecated] The class `LeafSpec` is deprecated: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead. torch/utils/_pytree.py:1344:24: warning[deprecated] The class `LeafSpec` is deprecated: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead. -torch/utils/_pytree.py:1917:40: error[invalid-argument-type] Argument to function `_treespec_to_json` is incorrect: Expected `TreeSpec`, found `` +torch/utils/_pytree.py:1917:40: error[invalid-argument-type] Argument to function `_treespec_to_json` is incorrect: Expected `TreeSpec`, found `` torch/utils/_stats.py:26:12: error[unresolved-attribute] Object of type `(**_P@count) -> _R@count` has no attribute `__qualname__` torch/utils/_stats.py:27:33: error[unresolved-attribute] Object of type `(**_P@count) -> _R@count` has no attribute `__qualname__` torch/utils/_stats.py:28:29: error[unresolved-attribute] Object of type `(**_P@count) -> _R@count` has no attribute `__qualname__`