Closed mtdudek closed 1 week ago
I've discovered more things regarding parameters in structs:
{}
syntax aren't evaluated in ConcretizeStructAnnotation
,ParametricExpression
that is used to represent {}
statements,ConcretizeStructAnnotation
is a bit confusing, as parameters are scanned in order, but evaluation has access to all parameters at once.
Describe the bug When parametrized function returns parametrized struct as an function value, parser/type checker fails with
TypeInferenceError
.Struct has inferred parameters that aren't resolved during
InstantiateParametricFunction
.Code that triggers this bug:
Switching order of function calls results
in the following error:
To Reproduce Steps to reproduce the behavior:
interpreter_main
file.x
interpreter_main file.x
Expected behavior Interpreter should correctly deduce types for parametric structs.
Environment (this can be helpful for troubleshooting):
Additional context Tested on the newest available main(ea5c4dc24d50951374089c6727ca610e919d124a) I've already looked into code base for function instantiation, and it doesn't check if return or argument types contain parametrized structs. That unfortunately leads to the
EagerlyPopulateParametricEnvMap
missing struct inferred parameters. I' wonder if adding extra step in theInstantiateParametricFunction
(typed_parametrics
) would fix this issue.