eclipse-archived/ceylon

Value constructor of static inner class not visible outside module

Closed this issue · 3 comments

In module "referenced," whose sole package I have explicitly "shared," I have the following class:

shared class ContainingClass {
    shared static class MemberClass of namedInstance {
        shared new namedInstance {}
    }
    shared new() {}
}

When I try to reference the value ContainingClass.MemberClass.namedInstance from code in another module, such as with the following code in module "referencing", it fails to compile:

import referenced {
    ContainingClass
}
void run() {
    // error: method or attribute is not visible: 'namedInstance' of type 'MemberClass' is package private
    value item = ContainingClass.MemberClass.namedInstance;
}

In the Eclipse IDE, when other compiler-bug-triggering code is present in the project (though not the same module) the above seems to compile fine, but when I commented out every other error-causing line it complains about a backend error: "Ceylon backend error: getMemberClass$namedInstance() is not public in referenced.ContainingClass; cannot be accessed from outside package"

ceylon --version reports ceylon version 1.3.3 0d594b3 (Contents May Differ), and in case it might be relevant this is on Mac OS X Sierra, installed via Homebrew; the Eclipse plugin is AFAICT the latest, which the "About Eclipse Features" reports as version 1.3.3v20170818-1632-Final

Confirmed. This is a very serious bug. Thanks for reporting!

This is now fixed, but:

  1. it does need an additional test, and
  2. there is a completely separate bug with callable constructors of static member classes that I also need to report and fix.

I've added the test and opened #7421. Closing.