Closed ChengCat closed 5 years ago
Thanks for this, it looks good. The only change I'd like to make is to drop the ReferenceVariableInDifferentFunction
error, because it works differently from the existing 'variable not in scope' errors, and those existing errors will be displayed whenever the new errors are displayed anyway. Does that sound OK?
Thanks for the feedback. I originally added that error, because my mental model is that the variable is in the scope, but can't be referenced as a value. (Function scope is viewed as a compiler implementation detail.)
I have removed the error, and changed VariableNotInScope
's error message to indicate the different possible cause. Does it look OK?
Yep, these changes look good, thanks.
The namespace escaping behaviour has been removed, and a new machanism for checking invalid variable reference is added.
This is mostly done, and the error reporting could be improved:
error-src/anonymous-scopes.dt
generates two "can't reference variable in a different function" errors.I tackle this issue (#208) first instead of #201, because this seems to be easier, and it's more urgent for my use.