feat(report): add T-Assign rule

This commit is contained in:
2026-07-19 22:18:09 +02:00
parent d4e603c5b1
commit fd371d1c51
3 changed files with 10 additions and 1 deletions

View File

@@ -173,6 +173,8 @@ Finally, expressions can be used in statements, which are special constructs tha
#smallcaps[T-Annot] is a rule which handles Python type annotations. It states that the type checker must take note of type hints in the context.
#smallcaps[T-Assign] handles assignments to variables. For an assignment to be valid, the value must be of the same type as the variable's type (modulo subsumption, #smallcaps[T-Sub]).
#smallcaps[T-Seq] allows sequences of statements.
#smallcaps[T-IfElse], like #smallcaps[T-Tern] is a stricter version of how Python processes `if` statements. Indeed, Midas will not allow leaking context from inside the bodies of any branch. If a variable is declared inside an `if` statement, Midas will not allow references outside of it.

View File

@@ -95,6 +95,13 @@
$Gamma tack "x": "T" tack.l Gamma, "x": "T"$,
```py x: T```,
),
rule(
"T-Assign",
$Gamma tack "x": "T"$,
$Gamma tack "t": "T"$,
$Gamma tack "x" = "t" tack.l Gamma$,
```py x = t```,
),
rule(
"T-Seq",
$Gamma tack "s"_1 tack.l Gamma'$,

View File

@@ -121,7 +121,7 @@ During parsing, a statement such as ```python foo: int = 3```, represented in Py
This method basically materializes #smallcaps[T-Annot] from @tab:typing-statements.
Handling the variable assignment part is a bit more involved, because Python (and our type checker) allows both assigning to multiple targets simultaneously (@fig:python-visit_assign_stmt:3) and assigning to attributes and subscripts (not only variables). This is the reason we use a `match` statement in @fig:python-visit_assign_stmt.
Handling the variable assignment part is a bit more involved, because Python (and our type checker) allows both assigning to multiple targets simultaneously (@fig:python-visit_assign_stmt:3) and assigning to attributes and subscripts (not only variables). This is the reason we use a `match` statement in @fig:python-visit_assign_stmt. This function embodies #smallcaps[T-Assign].
#codly(
ranges: (