Hi Dan,

----- Mail original -----
> De: "daniel smith" <[email protected]>
> À: "Remi Forax" <[email protected]>
> Cc: "Gavin Bierman" <[email protected]>, "amber-spec-experts" 
> <[email protected]>
> Envoyé: Lundi 13 Avril 2020 21:13:51
> Objet: Re: Record component type can be an inner class of a record

>> On Apr 13, 2020, at 11:08 AM, [email protected] wrote:
>> 
>> I believe you're right, the following code should not compile, apart if you 
>> want
>> to write puzzler for a living :)
>> 
>> class A { int y; }
>>   
>> record B(A a) implements I {
>>   public static void main(String[] args) {
>>     System.out.println(new B(null).a().x);
>>   }
>> }
>>  
>> interface I {
>>   class A { int x; }
>> }
> 
> You're proposing a novel error check, which I'm not sure is a good idea.

I think you mis-read it.
It's an example that shows that depending if the record component type is 
resolve as part of outside of the record or inside the record, not the same A 
is picked.
The A at top level declare a field "y" while the A inside I declare a field 
"x", that why it doesn't compile.
So it's not a new error check.

regards,
Rémi

Reply via email to