Description
When a func-typed variable is used inside string interpolation ${}, the typechecker does not reject it. The codegen then leaks the raw C function pointer as a decimal integer string into the program output.
Repro
do greet() -> string {
return "hi"
}
do main() {
mut f = ()greet
println("${f}")
}
Expected: Typechecker rejects with E3041 — function references cannot be interpolated.
Actual: Compiles and prints the raw pointer address as a decimal string (e.g., 4334929444).
Root cause
The interpolation validation only checked for bare func type via strcmp(pt->name, "func") == 0. Typed function references like func()->string have TK_FUNCTION kind, which was not being checked.
Description
When a func-typed variable is used inside string interpolation
${}, the typechecker does not reject it. The codegen then leaks the raw C function pointer as a decimal integer string into the program output.Repro
Expected: Typechecker rejects with E3041 — function references cannot be interpolated.
Actual: Compiles and prints the raw pointer address as a decimal string (e.g.,
4334929444).Root cause
The interpolation validation only checked for bare
functype viastrcmp(pt->name, "func") == 0. Typed function references likefunc()->stringhaveTK_FUNCTIONkind, which was not being checked.