motoko
motoko copied to clipboard
BUG: mis-compilation of floating point literal patterns
Float point literal patterns are accepted by the type checker but not compiled correctly.
- executed in the interpreter
- non implemented in the compiler(s).
We should either rule them out or support them.
Repro:
https://m7sm4-2iaaa-aaaab-qabra-cai.raw.ic0.app/?tag=168118266
actor Echo {
// Say the given phase.
public query func check(number : Float) : async { #Zero; #NotZero } {
switch (number) {
case (0) #Zero;
case (_) #NotZero;
};
};
};
Call check(0.0) produces Canister called ic0.trap with message: TODO: compile_lit_pat
Slack discussion: https://dfinity.slack.com/archives/CPL67E7MX/p1726572384749519