Math.max, Math.sqrt and the rest (and the bare min/max/abs/clamp) are computed inline by the
emitter, and L4 gave each the unknown type, which agrees with everything: Maroon Lake's trail
put Math.max(5, n) into Notify's string field a1 and it failed in LLVM ("%t63 defined with type
i32 but expected ptr"). It was never about two dispatches on a line - one is enough. The checker
now mirrors the emitter: a float/double first argument gives that type (sign an int); otherwise
min/max/abs/clamp keep the first argument's type, sign/floor/ceil/round/posmod/wrap/ping_pong are
ints, the rest fixed. Named arguments or an argument it cannot type leave it unknown.
rejected/math_into_text is the case. Reseeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
641 B
Text
16 lines
641 B
Text
# L4: Math.max is typed like any call - its int is refused in an action's text field, the second
|
|
# of two dispatches on one line (it once passed as "unknown" and failed in LLVM)
|
|
program MathIntoText {
|
|
numbers float
|
|
action Note { text: string, a1: string = "", i1: int = 0 }
|
|
state Log { n: int = 0 }
|
|
reducer Log on Note(log: mut Log, a: Note) { log.n = log.n + a.i1 }
|
|
function said(k: int, d: float) -> void {
|
|
let m = Math.max(5, int(d / 5.0 + 0.5) * 5)
|
|
if k > 0 { dispatch Note { text: "about {1} m", i1: m } } else { dispatch Note { text: "about {1} m", a1: m } }
|
|
}
|
|
entry {
|
|
said(1, 12.0)
|
|
drain_actions()
|
|
}
|
|
}
|