Summary
Follow-on to #551 (fixed in #552, wfl 26.7.2). Builtin calls now infer correctly inside included files — thanks! But several other right-hand-side expression forms still fail type inference when assigned to a variable inside an included file, and each one is fatal:
error[ERROR]: Type error in included file 'mod.wfl': Type error at line N, column 5: Could not infer type for variable 'v'
Environment
What still fails vs. what works
Each row is store v as <RHS> inside an action in an included file, called from the main program:
| RHS form |
Example |
Result |
| builtin call |
touppercase of a, substring of a and 0 and 1, wflhash256 of a, parse_json of s |
✅ (fixed in #552) |
| arithmetic |
5 plus 3 |
✅ |
| action-call result |
call some_action with a |
✅ |
| list index |
parts[0] (where parts is string_split of a and "-") |
❌ |
| object index |
rec["k"] (where rec is parse_json of ...) |
❌ |
| comparison result |
a is equal to b (also is greater than or equal to, etc.) |
❌ |
length of result |
length of a |
❌ |
All four failing forms type-check fine in the main file; only the included-file path can't infer them.
Minimal reproduction
mod.wfl:
define action called f with parameters a and b:
store parts as string_split of a and "-"
store v as parts[0] // ❌ "Could not infer type for variable 'v'"
return v
end action
main.wfl:
include from "mod.wfl"
store r as call f with "x-y" and "z"
display r
Swap the store v as ... line for store v as a is equal to b, store v as length of a, or (with store rec as parse_json of "{\"k\":1}") store v as rec["k"] to reproduce each variant.
Why it matters
These are bread-and-butter operations — splitting a key and reading parts[1], reading fields off a parsed-JSON object, storing a comparison into a boolean. A real shared library can't avoid them, so include from still isn't usable for a stdlib-heavy module (e.g. a license signer/validator) even after #551. Closing these four RHS forms should make include from fully viable end to end.
Likely cause / suggestion
Same shape as #551: the include type-inference path needs return/result-type handling for IndexExpression (list and map), comparison/BinaryOp boolean results, and the length of operator — mirroring whatever the analyzer/type checker does for these in the main-file path.
Repro test idea
Extend tests/docs_parser_and_include_fixes_test.rs: an included action that does store x as parts[0], store x as rec["k"], store x as a is equal to b, and store x as length of a, each called from the main program, should type-check and run.
Summary
Follow-on to #551 (fixed in #552, wfl 26.7.2). Builtin calls now infer correctly inside included files — thanks! But several other right-hand-side expression forms still fail type inference when assigned to a variable inside an included file, and each one is fatal:
Environment
26.7.2(main @4602406, i.e. after Fix type inference for builtins in included files (issue #551) #552), Linux release buildWhat still fails vs. what works
Each row is
store v as <RHS>inside an action in an included file, called from the main program:touppercase of a,substring of a and 0 and 1,wflhash256 of a,parse_json of s5 plus 3call some_action with aparts[0](wherepartsisstring_split of a and "-")rec["k"](whererecisparse_json of ...)a is equal to b(alsois greater than or equal to, etc.)length ofresultlength of aAll four failing forms type-check fine in the main file; only the included-file path can't infer them.
Minimal reproduction
mod.wfl:main.wfl:Swap the
store v as ...line forstore v as a is equal to b,store v as length of a, or (withstore rec as parse_json of "{\"k\":1}")store v as rec["k"]to reproduce each variant.Why it matters
These are bread-and-butter operations — splitting a key and reading
parts[1], reading fields off a parsed-JSON object, storing a comparison into a boolean. A real shared library can't avoid them, soinclude fromstill isn't usable for a stdlib-heavy module (e.g. a license signer/validator) even after #551. Closing these four RHS forms should makeinclude fromfully viable end to end.Likely cause / suggestion
Same shape as #551: the include type-inference path needs return/result-type handling for
IndexExpression(list and map), comparison/BinaryOpboolean results, and thelength ofoperator — mirroring whatever the analyzer/type checker does for these in the main-file path.Repro test idea
Extend
tests/docs_parser_and_include_fixes_test.rs: an included action that doesstore x as parts[0],store x as rec["k"],store x as a is equal to b, andstore x as length of a, each called from the main program, should type-check and run.