TypeCompatibility class
Defined in module l0_check_compat (l0_check_compat.py).
Assignment, cast, and scalar type-compatibility rules.
Protected functions
- auto _can_assign(self, Type target, Type source, * allow_promotion = False) -> bool
- Check if 'source' type can be assigned to 'target' type.
- auto _is_nullable_or_ptr(self, Type t) -> bool
- Check if type is nullable or a pointer.
- auto _is_int_assignable(self, Type|None typ) -> bool
- Check if type is 'int' or 'byte'.
- auto _get_const_int_for_explicit_cast(self, Expr expr) -> int|None
- Extract a compile-time integer value from a cast operand when available.
- auto _is_const_null_for_explicit_cast(self, Expr expr) -> bool
- Check whether a cast operand is provably null at compile time.
- auto _is_bool(self, Type|None typ) -> bool
- Check if type is 'bool'.
- auto _is_string(self, NullType|Type typ) -> bool
- Check if type is 'string'.
- auto _is_void(self, Type typ) -> bool
- Check if type is 'void'.
- auto _types_equal(self, Type a, Type b) -> bool
- Check if two types are exactly the same.