Class | ArgInferSecondPassQuery |
Query whether an argument type should be inferred in the second pass. |
Class | ExpressionChecker |
Expression type checker. |
Class | Finished |
Raised if we can terminate overload argument check early (no match). |
Class | HasAnyType |
Undocumented |
Class | HasErasedComponentsQuery |
Visitor for querying whether a type has an erased component. |
Class | HasTypeVarQuery |
Visitor for querying whether a type has a type variable component. |
Class | HasUninhabitedComponentsQuery |
Visitor for querying whether a type has an UninhabitedType component. |
Class | TooManyUnions |
Indicates that we need to stop splitting unions in an attempt to match an overload in order to save performance. |
Function | all_same_types |
Undocumented |
Function | any_causes_overload_ambiguity |
May an argument containing 'Any' cause ambiguous result type on call to overloaded function? |
Function | arg_approximate_similarity |
Return if caller argument (actual) is roughly compatible with signature arg (formal). |
Function | extract_refexpr_names |
Recursively extracts all module references from a reference expression. |
Function | get_partial_instance_type |
Undocumented |
Function | has_any_type |
Whether t contains an Any type |
Function | has_bytes_component |
Is this one of builtin byte types, or a union that contains it? |
Function | has_coroutine_decorator |
Whether t came from a function decorated with @coroutine . |
Function | has_erased_component |
Undocumented |
Function | has_uninhabited_component |
Undocumented |
Function | is_async_def |
Whether t came from a function defined using async def . |
Function | is_duplicate_mapping |
Undocumented |
Function | is_expr_literal_type |
Returns 'true' if the given node is a Literal |
Function | is_non_empty_tuple |
Undocumented |
Function | is_operator_method |
Undocumented |
Function | merge_typevars_in_callables_by_name |
Takes all the typevars present in the callables and 'combines' the ones with the same name. |
Function | replace_callable_return_type |
Return a copy of a callable type with a different return type. |
Function | try_getting_literal |
If possible, get a more precise literal type for a given type. |
Function | type_info_from_type |
Gets the TypeInfo for a type, indirecting through things like type variables and tuples. |
Constant | MAX_UNIONS |
Undocumented |
Constant | OVERLAPPING_TYPES_ALLOWLIST |
Undocumented |
Variable | ArgChecker |
Undocumented |
May an argument containing 'Any' cause ambiguous result type on call to overloaded function?
Note that this sometimes returns True even if there is no ambiguity, since a correct implementation would be complex (and the call would be imprecisely typed due to Any types anyway).
Parameters | |
items:List[ | Undocumented |
return_types:List[ | Undocumented |
arg_types:List[ | Undocumented |
arg_kinds:List[ | Undocumented |
arg_names:Optional[ | Undocumented |
Returns | |
bool | Undocumented |
Return if caller argument (actual) is roughly compatible with signature arg (formal).
This function is deliberately loose and will report two types are similar as long as their "shapes" are plausibly the same.
This is useful when we're doing error reporting: for example, if we're trying to select an overload alternative and there's no exact match, we can use this function to help us identify which alternative the user might have meant to match.
Parameters | |
actual:Type | Undocumented |
formal:Type | Undocumented |
Returns | |
bool | Undocumented |
Recursively extracts all module references from a reference expression.
Note that currently, the only two subclasses of RefExpr are NameExpr and MemberExpr.
Parameters | |
expr:RefExpr | Undocumented |
Returns | |
Set[ | Undocumented |
Parameters | |
t:Type | Undocumented |
ignore_in_type_obj:bool | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
typ:Type | Undocumented |
py2:bool | Undocumented |
Returns | |
bool | Undocumented |
@coroutine
.Parameters | |
t:Type | Undocumented |
Returns | |
bool | Undocumented |
async def
.Parameters | |
t:Type | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
node:Expression | Undocumented |
Returns | |
bool | Undocumented |
Takes all the typevars present in the callables and 'combines' the ones with the same name.
For example, suppose we have two callables with signatures "f(x: T, y: S) -> T" and "f(x: List[Tuple[T, S]]) -> Tuple[T, S]". Both callables use typevars named "T" and "S", but we treat them as distinct, unrelated typevars. (E.g. they could both have distinct ids.)
If we pass in both callables into this function, it returns a list containing two new callables that are identical in signature, but use the same underlying TypeVarType for T and S.
This is useful if we want to take the output lists and "merge" them into one callable in some way -- for example, when unioning together overloads.
Returns both the new list of callables and a list of all distinct TypeVarType objects used.
Parameters | |
callables:Sequence[ | Undocumented |
Returns | |
Tuple[ | Undocumented |
Parameters | |
c:CallableType | Undocumented |
new_ret_type:Type | Undocumented |
Returns | |
CallableType | Undocumented |
Parameters | |
typ:Type | Undocumented |
Returns | |
ProperType | Undocumented |