Record component type can be an inner class of a record

John Rose john.r.rose at oracle.com
Tue Apr 28 00:13:57 UTC 2020


On Apr 20, 2020, at 3:32 PM, Dan Smith <daniel.smith at oracle.com> wrote:
> 
> My point: there are no references to 'A' inside the body. The only reference to 'A' in this program unambiguously refers to the top-level A.
> 
> You seem to be assuming that there will be resolution problems involved in checking the implicit members. And my response is that it's not our job to perform name resolution for implicit members—they are defined more abstractly than that. Specifically, the return type of the 'a' method is the type referenced by the type name 'A' appearing after 'record B(' in the program, as it is resolved *at that location*.


Perhaps this sort of question can be avoided if we ensure that
desugaring pseudocode specifies that introduced occurrences
of types are not re-resolved at their introduced points.  One
way to do this (with overkill) is to make sure there are fake
package prefixes on introduced occurrences:

record R(A x) extends AnotherADeclarer { }
(where A is fully qualified as pa.A)
=>
final class R extends AnotherADeclarer {
  pa.A x;
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200427/839932a6/attachment-0001.htm>


More information about the amber-spec-experts mailing list