[lworld] RFR: 8280382: [lworld] JCWithField AST node support should evolve to work with value classes

Srikanth Adayapalam sadayapalam at openjdk.java.net
Fri Jan 28 07:10:26 UTC 2022


On Fri, 28 Jan 2022 05:26:07 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

>> This PR ports basic `withField` tests from lworld-values to value-objects and extending some areas of code to support `withField` within value classes.
>> 
>> Nitpicking and a note: one of the error messages is now `compiler.err.primitive.or.value.class.instance.field.expected.here`. Would you propose to disambiguate further depending whether we are inside a `primitive` or a `value` class?
>
> test/langtools/tools/javac/valhalla/value-objects/WithFieldOperatorTest.java line 33:
> 
>> 31:             x = __WithField(x.x, 12.0); // float cannot be assigned to int
>> 32:             x = __WithField(x.v, null); // null cannot be assigned to value
>> 33:             return x;
> 
> Null can be assigned to value, so this line should not trigger an error

Also this test in lworld-values directory should be amended to say "null cannot be assigned to primitive class instance" - it should not say value. Confusingly, at a distant past point, B3 classes used to be called value classes and hence this test refers to stale terminology

-------------

PR: https://git.openjdk.java.net/valhalla/pull/621



More information about the valhalla-dev mailing list