[code-reflection] RFR: Computes the VarOp's result type from its operand type, if not overridden
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Jun 18 11:00:29 UTC 2024
On Mon, 17 Jun 2024 21:55:25 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> It's currently hard to apply a simple retyping transformation to a code model since the variable operation, `VarOp`, fixes its result type when copying. `VarOp` now supports a fixed result type only when the init operand's type, `T` say, is not equal to the value type of the VarOp's result type, `U` say for `Var<U>`.
>
> This works but we might need to revisit and remove any notion of a fixed result type when copying. (We can behave differently when constructing from an externalized operation.)
>
> Also renamed some methods and added some helper methods.
Looks good. It seems like this rule will more or less allow to rewrite variables declared with `var` in a natural fashion (as the condition you check for should always hold in these cases). It is also somewhat good that we expanded the set of types that are denotable in the model, otherwise erasure would have causes a lot of mismatches.
I wonder if, like in the source code, we need a notion of `Var` without an explicit type (e.g. make "overridability of type" a property in the model).
-------------
PR Comment: https://git.openjdk.org/babylon/pull/148#issuecomment-2175816466
More information about the babylon-dev
mailing list