Ok, I've started investigating and can reproduce the bug (even on master) so we still have it. The basic problem is that private shared is illegal, producing an ill-formed class with annotation None and the compiler falls over importing it since it assumes all classes have function type (never None).
I don't fully understand why the pipeline continues checking the root file once a library has failed to type-check though...
Distilled repro:
issue-2158.mo
// warning: compiler crash only manifests itself with
// moc -c issue-2158.mo
// because run.sh -d won't compile if --check fails (AFAICT)
import T "issue-2158/Types";
import C "issue-2158/C";
actor a {
shared func f () : async() {
await C.C();
}
}
issue-2158/C.mo
import Types "Types";
shared actor class C() {
public func g() {};
private shared func f() {};
}
Full repro here https://github.com/nzoghb/motoko-bugs
Ok, I've started investigating and can reproduce the bug (even on master) so we still have it. The basic problem is that private shared is illegal, producing an ill-formed class with annotation
None
and the compiler falls over importing it since it assumes all classes have function type (never None).I don't fully understand why the pipeline continues checking the root file once a library has failed to type-check though...
Distilled repro:
issue-2158.mo
issue-2158/C.mo
issue-2158/Types.mo