-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
We have an internal representation (Type::Any) for the dynamic type Any, but we don't yet understand the typing.Any symbol as a spelling for that type in a type expression.
To add this, we'll need to track typing.Any as a KnownInstance (similar to the existing support for typing.Union, typing.Optional, typing.Literal), and add support for it in Type::in_type_expression, so that when TypeInferenceBuilder::infer_type_expression comes across the symbol in an annotation, we understand that annotation as describing the Any type.
We'll want to add mdtests for the "happy path" case like this:
x: Any = 1
x = "foo"
def f():
reveal_type(x) # revealed: AnyWe'll also want edge-case tests showing that typing.Any can be aliased to a different name, and still works (that is, we are recognizing typing.Any under any name, not just pattern-matching on the local name), and similarly that a locally-defined class named Any simply means its own instance type, not Type::Any, in an annotation.