Skip to content

Fix handling of constness in Typifier

Frederik Hennig requested to merge fhennig/fix-const-typing into backend-rework

Improves the handling of constness in the typifier.

Left-hand sides of non-declaration assignments may not be const. For the typifier to tell apart const from non-const expressions, it needs to track constness in the TypeContext. This MR adds that ability: All expressions are now by default assigned const types, unless otherwise specified. This does not change the handling of untyped symbols, which still receive the default_dtype. A PsSymbolExpr may therefore now have a different const qualifier than its wrapped PsSymbol.

Additionally, this MR further documents and clarified the behaviour and control flow of the typifier.

Edited by Frederik Hennig

Merge request reports