Calculate some properties of classes.
These happen after semantic analysis and before type checking.
Function | add_type_promotion |
Setup extra, ad-hoc subtyping relationships between classes (promotion). |
Function | calculate_class_abstract_status |
Calculate abstract status of a class. |
Function | calculate_class_vars |
Try to infer additional class variables. |
Function | check_protocol_status |
Check that all classes in MRO of a protocol are protocols |
Constant | TYPE_PROMOTIONS |
Undocumented |
Constant | TYPE_PROMOTIONS_PYTHON2 |
Undocumented |
Constant | TYPE_PROMOTIONS_PYTHON3 |
Undocumented |
Setup extra, ad-hoc subtyping relationships between classes (promotion).
This includes things like 'int' being compatible with 'float'.
Parameters | |
info:TypeInfo | Undocumented |
module_names:SymbolTable | Undocumented |
options:Options | Undocumented |
Calculate abstract status of a class.
Set is_abstract of the type to True if the type has an unimplemented abstract attribute. Also compute a list of abstract attributes. Report error is required ABCMeta metaclass is missing.
Parameters | |
typ:TypeInfo | Undocumented |
is_stub_file:bool | Undocumented |
errors:Errors | Undocumented |
Try to infer additional class variables.
Subclass attribute assignments with no type annotation are assumed to be classvar if overriding a declared classvar from the base class.
This must happen after the main semantic analysis pass, since this depends on base class bodies having been fully analyzed.
Parameters | |
info:TypeInfo | Undocumented |