dfinity / motoko

Simple high-level language for writing Internet Computer canisters
Apache License 2.0
515 stars 97 forks source link

Bug: Typing (User Reported) #2158

Closed crusso closed 3 years ago

crusso commented 3 years ago

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

// 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() {};
}

issue-2158/Types.mo

module {
  type T = Nat
};
rossberg commented 3 years ago

Can you copy the bug description? We don't have access to that repo.

crusso commented 3 years ago

There isn't one yet - I need to investigate - this was mostly a tracking issue for me (and I do have access to the repo)