Open crusso opened 1 year ago
Repro: issue-3740.mo
actor {
type Unit = ();
public func f() : async Unit {
};
public func go() : async () {
await f();
};
}
[nix-shell:~/clean/motoko/test/run-drun]$ moc issue-3740
Ill-typed intermediate code after Async Lowering (use -v to see dumped IR):
issue-3740:8.11-8.14: IR type error [M0000], subtype violation:
(Unit__2 -> (), Error -> ()) -> {#schedule : () -> (); #suspend}
(() -> (), Error -> ()) -> {#schedule : () -> (); #suspend}
Raised at Ir_def__Check_ir.error.(fun) in file "ir_def/check_ir.ml", line 95, characters 30-92
Called from Ir_def__Check_ir.check_exp.(<:) in file "ir_def/check_ir.ml" (inlined), line 367, characters 19-45
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 697, characters 4-17
Called from Ir_def__Check_ir.check_dec in file "ir_def/check_ir.ml", line 1086, characters 4-21
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 695, characters 4-22
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 696, characters 4-23
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 778, characters 4-40
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 391, characters 4-32
Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 778, characters 4-40
Called from Ir_def__Check_ir.check_dec in file "ir_def/check_ir.ml", line 1086, characters 4-21
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Ir_def__Check_ir.check_comp_unit in file "ir_def/check_ir.ml", line 1148, characters 4-23
Called from Ir_def__Check_ir.check_prog in file "ir_def/check_ir.ml", line 1167, characters 6-28
Pesky tuples again.
The quest for a better solution is on.
https://forum.dfinity.org/t/type-error-m0139-inner-actor-classes-are-not-supported-yet/18135/12
Fixed by #3741 but in a hacky way. Leaving issue open for a more principled fix. See discussion in #3471.