Freeze casts of bare constants to typed PsConstantExprs
- Jul 26, 2024
-
-
Daniel Bauer authored2b8884d9
-
- Jul 24, 2024
-
-
Daniel Bauer authoredd1a9c0ef
-
The type of the argument to a cast is hard to infer because there is no context from the enclosing scope. Unless a typed symbol appears in the argument, the typifier has no way to determine the type of the argument. For more discussion see #97.
This MR fixes the issue for casts of bare constants, e.g. CastFunc(0, float64)
by freezing them to constants of the target type directly.
Additionally, the typifier now raises an error if the type of an argument to a cast can not be determined.