Function | calculate_return_type |
Return the return type if we can calculate it. |
Function | find_fixed_callable_return |
Return the return type, if expression refers to a callable that returns a callable. |
Function | infer_decorator_signature_if_simple |
Try to infer the type of the decorated function. |
Function | is_identity_signature |
Is type a callable of form T -> T (where T is a type variable)? |
Return the return type if we can calculate it.
This only uses information available during semantic analysis so this will sometimes return None because of insufficient information (as type inference hasn't run yet).
Parameters | |
expr:Expression | Undocumented |
Returns | |
Optional[ | Undocumented |
Return the return type, if expression refers to a callable that returns a callable.
But only do this if the return type has no type variables. Return None otherwise. This approximates things a lot as this is supposed to be called before type checking when full type information is not available yet.
Parameters | |
expr:Expression | Undocumented |
Returns | |
Optional[ | Undocumented |
Try to infer the type of the decorated function.
This lets us resolve additional references to decorated functions during type checking. Otherwise the type might not be available when we need it, since module top levels can't be deferred.
This basically uses a simple special-purpose type inference engine just for decorators.
Parameters | |
dec:Decorator | Undocumented |
analyzer:SemanticAnalyzerInterface | Undocumented |