l0_check_expr.py

l0_check_expr.py

Module: l0_check_expr

Source: compiler/stage1_py/l0_check_expr.py Language: Python

Symbols

Namespace l0_check_expr

Class l0_check_expr::ExpressionInference

Mutually recursive expression inference over explicit semantic dependencies.

Member Data l0_check_expr.ExpressionInference.compat

1
TypeCompatibility compat

Member Data l0_check_expr.ExpressionInference.liveness

1
ExpressionLiveness liveness

Member Data l0_check_expr.ExpressionInference.lookup

1
SemanticLookup lookup

Member Data l0_check_expr.ExpressionInference.state

1
CheckerState state

Function l0_check_expr.ExpressionInference._infer_type_expr

1
Type | None l0_check_expr.ExpressionInference._infer_type_expr(self, TypeExpr expr)

TypeExpr is only valid as an argument to type-accepting intrinsics.

Function l0_check_expr.ExpressionInference._infer_expr

1
Type | None l0_check_expr.ExpressionInference._infer_expr(self, Expr|None expr, *Type|None widening_type=None, str context_code="TYP-0319", str context_descriptor="expression")

Infer the type of an expression.

Parameters:

  • expr: The expression to type-check.
  • widening_type: Optional expected type for context-sensitive checking.
  • context_code: Diagnostic code for type mismatch.
  • context_descriptor: Description of context for diagnostic.

Returns: The resolved Type of the expression, or None on error.

Function l0_check_expr.ExpressionInference._infer_var_ref

1
Type | None l0_check_expr.ExpressionInference._infer_var_ref(self, VarRef expr)

Infer type for a variable reference.

Function l0_check_expr.ExpressionInference._infer_unary

1
Type | None l0_check_expr.ExpressionInference._infer_unary(self, UnaryOp expr)

Infer type for a unary operation.

Function l0_check_expr.ExpressionInference._infer_binary

1
Type | None l0_check_expr.ExpressionInference._infer_binary(self, BinaryOp expr)

Infer type for a binary operation.

Function l0_check_expr.ExpressionInference._binary_expect_both_int

1
Type | None l0_check_expr.ExpressionInference._binary_expect_both_int(self, BinaryOp expr, Type|None left, Type|None right, Type|None result)

Check that both operands of a binary op are int-assignable.

Function l0_check_expr.ExpressionInference._binary_expect_both_bool

1
Type | None l0_check_expr.ExpressionInference._binary_expect_both_bool(self, BinaryOp expr, Type|None left, Type|None right, Type|None result)

Check that both operands of a binary op are bool.

Function l0_check_expr.ExpressionInference._binary_equality

1
Type | None l0_check_expr.ExpressionInference._binary_equality(self, BinaryOp expr, Type|None left, Type|None right)

Infer type for equality/inequality comparison.

Function l0_check_expr.ExpressionInference._try_infer_intrinsic

1
Type | None l0_check_expr.ExpressionInference._try_infer_intrinsic(self, CallExpr expr)

Handle compiler intrinsics calls.

Function l0_check_expr.ExpressionInference._infer_sizeof_intrinsic

1
Type l0_check_expr.ExpressionInference._infer_sizeof_intrinsic(self, CallExpr expr)

Handle sizeof(T) or sizeof(expr) intrinsic.

Function l0_check_expr.ExpressionInference._infer_ord_intrinsic

1
Type l0_check_expr.ExpressionInference._infer_ord_intrinsic(self, CallExpr expr)

Handle ord(enum_value) intrinsic - returns 0-based ordinal of enum variant.

Function l0_check_expr.ExpressionInference._infer_call

1
Type | None l0_check_expr.ExpressionInference._infer_call(self, CallExpr expr)

Infer type for a function or constructor call.

Function l0_check_expr.ExpressionInference._infer_struct_constructor

1
Type | None l0_check_expr.ExpressionInference._infer_struct_constructor(self, CallExpr expr, Symbol sym)

Infer type for a struct constructor call.

Function l0_check_expr.ExpressionInference._infer_variant_constructor

1
Type | None l0_check_expr.ExpressionInference._infer_variant_constructor(self, CallExpr expr, Symbol sym)

Infer type for an enum variant constructor call.

Function l0_check_expr.ExpressionInference._infer_index

1
Type | None l0_check_expr.ExpressionInference._infer_index(self, IndexExpr expr)

Infer type for an indexing expression.

Function l0_check_expr.ExpressionInference._infer_field_access

1
Type | None l0_check_expr.ExpressionInference._infer_field_access(self, FieldAccessExpr expr)

Infer type for a field access expression.

Function l0_check_expr.ExpressionInference._infer_cast

1
Type | None l0_check_expr.ExpressionInference._infer_cast(self, CastExpr expr)

Infer type for a cast expression and validate compatibility.

Function l0_check_expr.ExpressionInference._infer_try

1
Type | None l0_check_expr.ExpressionInference._infer_try(self, TryExpr expr)

Infer type for a ‘?’ try operator expression.

Function l0_check_expr.ExpressionInference._infer_new

1
Type | None l0_check_expr.ExpressionInference._infer_new(self, NewExpr expr)

Infer type for a ‘new’ heap allocation expression.