motoko
motoko copied to clipboard
BUG: unexpected cannot infer type of forward variable
import { debugPrint; principalOfActor } = "mo:⛔";
actor class C() = Self {
debugPrint "So far so good!"
}
produces
type error [M0055], cannot infer type of forward variable debugPrint
I think its happening because of the special treatment of the last declaration in a block, that determines its return type.
But it's odd that we don't consider the type of imported identifiers to be known (they should be I think).
Faced this issue right now:
import D "mo:dur";
import {dur} "mo:dur";
actor class Main() = this {
let DELAY = D.dur("1m"); // ok
let DELAY2 = dur("1m"); // type error [M0055], cannot infer type of forward variable dur