Generate warnings + multiple errors from within the typechecker #1483
Labels
C-Moderate Effort
Should take a moderate amount of time to address.
L-Error reporting
Reporting language or runtime errors to the player.
L-Type inference
The process of inferring the type of a Swarm expression.
S-Moderate
The fix or feature would substantially improve user experience.
Z-Developer Experience
This issue seeks to make life easier for developers writing Scenarios or other Swarm code.
Z-Feature
A new feature to be added to the game.
This is a pre-requisite for LSP support to warn on name shadowing. See #1338 (comment). The idea is that rather than stopping as soon as we encounter an error during typechecking, we simply log the error, make up a new unification variable to represent the type of the problematic subterm (so it won't prevent other things from typechecking), and continue. This way we can generate multiple type errors at once, just like other real-world languages with static typechecking. If we want to be fancy we could even do something like GHC's
-fdefer-type-errors
where we replace terms that don't type check with calls toerror
, but allow everything else to load.Once we are logging errors in some kind of writer monad we can just as easily log warnings as well as errors.
See also:
The text was updated successfully, but these errors were encountered: