dfinity / motoko

Simple high-level language for writing Internet Computer canisters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moc Check Bug - 'public' as Variant Type

q-uint opened this issue · comments

I was converting this file to Motoko and stumbled on the following bug:

module T {
    public type LogVisibility = { #controllers; #public };
};

moc --check example.mo

syntax error [M0001], unexpected token 'public', expected one of token or sequence:
}
<annot_opt>

Can one avoid that by suffix the Motoko keyword public with an underscore, here "#public_"? @chenyan-dfinity ? I'll try it on the playground.

actor {
  
  public func name() : async {#public_} {
    #public_
  };
};

https://play.motoko.org/?tag=1499643541

Seems to work, in the sense that the candid interface uses public.

Quint, try:

module T {
    public type LogVisibility = { #controllers; #public_};
};