Class | CompleteTypeVisitor |
Undocumented |
Class | Constraint |
A representation of a type constraint. |
Class | ConstraintBuilderVisitor |
Visitor class for inferring type constraints. |
Function | any_constraints |
Deduce what we can from a collection of constraint lists. |
Function | find_matching_overload_item |
Disambiguate overload item against a template. |
Function | infer_constraints |
Infer type constraints. |
Function | infer_constraints_for_callable |
Infer type variable constraints for a callable and actual arguments. |
Function | infer_constraints_if_possible |
No summary |
Function | is_complete_type |
Is a type complete? |
Function | is_same_constraint |
Undocumented |
Function | is_same_constraints |
Undocumented |
Function | is_similar_constraints |
Check that two lists of constraints have similar structure. |
Function | merge_with_any |
Transform a constraint target into a union with given Any type. |
Function | neg_op |
Map SubtypeOf to SupertypeOf and vice versa. |
Function | select_trivial |
Select only those lists where each item is a constraint against Any. |
Function | simplify_away_incomplete_types |
Undocumented |
Constant | SUBTYPE_OF |
Undocumented |
Constant | SUPERTYPE_OF |
Undocumented |
Function | _infer_constraints |
Undocumented |
Function | _is_similar_constraints |
Check that every constraint in the first list has a similar one in the second. |
Deduce what we can from a collection of constraint lists.
It's a given that at least one of the lists must be satisfied. A None element in the list of options represents an unsatisfiable constraint and is ignored. Ignore empty constraint lists if eager is true -- they are always trivially satisfiable.
Parameters | |
options:List[ | Undocumented |
eager:bool | Undocumented |
Returns | |
List[ | Undocumented |
Parameters | |
overloaded:Overloaded | Undocumented |
template:CallableType | Undocumented |
Returns | |
CallableType | Undocumented |
Infer type constraints.
Match a template type, which may contain type variable references, recursively against a type which does not contain (the same) type variable references. The result is a list of type constrains of form 'T is a supertype/subtype of x', where T is a type variable present in the template and x is a type without reference to type variables present in the template.
Assume T and S are type variables. Now the following results can be calculated (read as '(template, actual) --> result'):
(T, X) --> T :> X (X[T], X[Y]) --> T <: Y and T :> Y ((T, T), (X, Y)) --> T :> X and T :> Y ((T, S), (X, Y)) --> T :> X and S :> Y (X[T], Any) --> T <: Any and T :> Any
The constraints are represented as Constraint objects.
Parameters | |
template:Type | Undocumented |
actual:Type | Undocumented |
direction:int | Undocumented |
Returns | |
List[ | Undocumented |
Infer type variable constraints for a callable and actual arguments.
Return a list of constraints.
Parameters | |
callee:CallableType | Undocumented |
arg_types:Sequence[ | Undocumented |
arg_kinds:List[ | Undocumented |
formal_to_actual:List[ | Undocumented |
context:ArgumentInferContext | Undocumented |
Returns | |
List[ | Undocumented |
Parameters | |
template:Type | Undocumented |
actual:Type | Undocumented |
direction:int | Undocumented |
Returns | |
Optional[ | Undocumented |
Is a type complete?
A complete doesn't have uninhabited type components or (when not in strict optional mode) None components.
Parameters | |
typ:Type | Undocumented |
Returns | |
bool | Undocumented |
Undocumented
Parameters | |
x:List[ | Undocumented |
y:List[ | Undocumented |
Returns | |
bool | Undocumented |
Check that two lists of constraints have similar structure.
This means that each list has same type variable plus direction pairs (i.e we ignore the target). Except for constraints where target is Any type, there we ignore direction as well.
Parameters | |
x:List[ | Undocumented |
y:List[ | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
constraint:Constraint | Undocumented |
Returns | |
Constraint | Undocumented |
Parameters | |
options:Sequence[ | Undocumented |
Returns | |
List[ | Undocumented |
Undocumented
Parameters | |
template:Type | Undocumented |
actual:Type | Undocumented |
direction:int | Undocumented |
Returns | |
List[ | Undocumented |
Check that every constraint in the first list has a similar one in the second.
See docstring above for definition of similarity.
Parameters | |
x:List[ | Undocumented |
y:List[ | Undocumented |
Returns | |
bool | Undocumented |