You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flowc: print(x) takes x's type from a same-named parameter of another function #993
The flowc print intrinsic resolves a variable's type by name across the whole module, so a parameter in one function can decide the printf format in another.
function show(tag: string) {
print(tag)
println("")
}
function count(tag: i32) -> i32 {
return tag + 1
}
function main() -> i32 {
show("hello")
return count(0) - 1
}
flowc emits printf("%d", tag); inside show, so the program prints a pointer value (45237528) instead of hello. Renaming count's parameter makes it print hello. The Python host prints hello.
Seen in examples/circuits/rc_rl_rlc.flow while checking flow-block programs on flowc (#681): row(name: string, method: string, ...) prints method as a number because mna_rc(method: i32, dt: f64) is declared later in the file.
Expected: the print intrinsic looks the name up in the enclosing function's scope (locals, then parameters) before module-level declarations.
Activity
fix(stage-a): resolve name types from the declaration in scope
fix(stage-a): resolve name types from the declaration in scope