File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
crates/ty_python_semantic
resources/mdtest/annotations Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ g(Bar(Foo(42)))
5353h(42 ) # error: [invalid-argument-type] "Argument to function `h` is incorrect: Expected `Bar`, found `Literal[42]`"
5454h(Foo(42 )) # error: [invalid-argument-type] "Argument to function `h` is incorrect: Expected `Bar`, found `Foo`"
5555h(Bar(Foo(42 )))
56+
57+ # Method lookup works.
58+ def _ (x : Bar):
59+ reveal_type(x.bit_length()) # revealed: int
5660```
5761
5862## The name must be a string literal
Original file line number Diff line number Diff line change @@ -6748,9 +6748,7 @@ impl<'db> Type<'db> {
67486748 // understand a more specific meta type in order to correctly handle `__getitem__`.
67496749 Type::TypedDict(typed_dict) => SubclassOfType::from(db, typed_dict.defining_class()),
67506750 Type::TypeAlias(alias) => alias.value_type(db).to_meta_type(db),
6751- Type::NewTypeInstance(newtype) => {
6752- Type::KnownInstance(KnownInstanceType::NewType(newtype))
6753- }
6751+ Type::NewTypeInstance(newtype) => Type::from(newtype.base_class_type(db)),
67546752 }
67556753 }
67566754
You can’t perform that action at this time.
0 commit comments