Summary
Follow-on to #547 (fixed in #550). The analyzer half is fixed — a stdlib call inside an included action no longer reports 'X' is not a function. But the type checker still cannot infer the type of a variable that is assigned a builtin-function result inside an included file, and it is fatal:
error[ERROR]: Type error in included file 'mod.wfl': Type error at line 2, column 5: Could not infer type for variable 'full'
Environment
Minimal reproduction
mod.wfl:
define action called h with parameters s:
store full as wflhash256 of s
return full
end action
main.wfl:
include from "mod.wfl"
store r as call h with "x"
display "R=" with r
wfl main.wfl →
error[ERROR]: Type error in included file 'mod.wfl': Type error at line 2, column 5: Could not infer type for variable 'full'
Also reproduces with parse_json (store p as parse_json of s) and, in my project, string_split, trim, touppercase, wflhash256_with_salt.
What works (scoping the bug)
| Case |
Result |
store full as wflhash256 of s in an included file |
❌ fatal "Could not infer type" |
| same line in the main file |
✅ works |
return substring of (wflhash256 of s) and 0 and 8 (inlined, no named var) in an included file |
✅ works |
store inner as call some_action with s (action-call result, not builtin) in an included file |
✅ works |
So it is specifically store <var> as <builtin-call> inside an included file. Inlining the builtin call (no intermediate variable) or storing an action-call result both type-check fine.
Likely cause
The #550 analyzer change taught the semantic analyzer to recognize builtins inside included files, but the type checker doesn't infer builtin return types in the include path — so a variable bound to a builtin result gets Unknown/uninferable and the type checker aborts. It probably needs the same "recognize builtins" treatment the analyzer got, applied to type inference (return-type lookup) for included files.
Impact
Any real shared library that binds a stdlib result to a variable (hashing, JSON parsing, text munging) still can't be included — the program aborts before running. Current workaround is to inline every builtin call or to concatenate sources at build time. With this fixed, include from would finally work for stdlib-using libraries end to end.
Repro test idea
Extending tests/docs_parser_and_include_fixes_test.rs: an included file with store x as wflhash256 of "a" (and a parse_json variant) called from the main program should run and type-check, not abort.
Summary
Follow-on to #547 (fixed in #550). The analyzer half is fixed — a stdlib call inside an included action no longer reports
'X' is not a function. But the type checker still cannot infer the type of a variable that is assigned a builtin-function result inside an included file, and it is fatal:Environment
26.7.1(main @1dad16a, i.e. after Fix parser, analyzer, and typechecker for documented forms and includes #550), Linux release buildMinimal reproduction
mod.wfl:main.wfl:wfl main.wfl→Also reproduces with
parse_json(store p as parse_json of s) and, in my project,string_split,trim,touppercase,wflhash256_with_salt.What works (scoping the bug)
store full as wflhash256 of sin an included filereturn substring of (wflhash256 of s) and 0 and 8(inlined, no named var) in an included filestore inner as call some_action with s(action-call result, not builtin) in an included fileSo it is specifically
store <var> as <builtin-call>inside an included file. Inlining the builtin call (no intermediate variable) or storing an action-call result both type-check fine.Likely cause
The #550 analyzer change taught the semantic analyzer to recognize builtins inside included files, but the type checker doesn't infer builtin return types in the include path — so a variable bound to a builtin result gets
Unknown/uninferable and the type checker aborts. It probably needs the same "recognize builtins" treatment the analyzer got, applied to type inference (return-type lookup) for included files.Impact
Any real shared library that binds a stdlib result to a variable (hashing, JSON parsing, text munging) still can't be
included — the program aborts before running. Current workaround is to inline every builtin call or to concatenate sources at build time. With this fixed,include fromwould finally work for stdlib-using libraries end to end.Repro test idea
Extending
tests/docs_parser_and_include_fixes_test.rs: an included file withstore x as wflhash256 of "a"(and aparse_jsonvariant) called from the main program should run and type-check, not abort.