Is there need for Opt_WarnOutOfScopeVariables flag (truly turn such errors in warnings)? And what is the best place for documentation?
While I do worry that the number of partial-type-error flags may be growing to be a bit large, I think we probably should include this for completeness (and perhaps enable it by default).
Regarding documentation, I think the following mentions would be helpful,
- docs/users_guide/glasgow_exts.rst in the deter-type-errors section: Describe the default treatment of out-of-scope errors and refer to -Wout-of-scope-variables.
- docs/users_guide/using-warnings.rst: Add a ghc-flag directive for -Wdefer-out-of-scope-variables. Make sure to explicitly mention that the flag only has an effect with -fdeter-type-errors.
- mkUserGuidePart/Options/Warnings.hs: Define -Wdefer-out-of-scope-variables. Again, be sure to mention its scope.
You need user manual changes too!
I've suggested doing it uniformly with the other two cases,
If we truly want this flag, can we treat it uniformly with the type holes and expression holes, by having cec_out_of_scope_holes just like cec_type_holes and cec_expr_holes. There are three things we might do: report an error, report a warning, or report nothing. That's what happens for the other two cases and we should behave the same here too, shouldn't we?
Maybe the flags don't support one of the three, but the mechanism (via cec_*) should be uniform.
OK thanks. I've suggested a little more explicit documentation, but otherwise good to go.
This is a subset of "Holes in expressions". Worth a comment or Note just to say what is an "expression hole" and what is an "out of scope hole"
Document the users-eye-view of how a "typed hole" differs from an "out of scope hole".
Changelog entry is missing. This would go in docs/users_guide/8.2.1-notes.rst normally.
Implies :ghc-flag:-fdefer-typed-holes and -fdefer-out-of-scope-variables.
Typo: the warning flag is called -Wdefer-out-of-scope-variables.
For consistency with -Wdeferred-type-errors, it should probably be called -Wdeferred-out-of-scope-variables (deferred instead of defer). What do you think?
Implied by :ghc-flag:-fdefer-type-errors.
Currently the name of the warning flag in the documentation and in the implementation don't match.
Please pick a name (I suggest -Wdeferred-out-of-scope-variables), and use it consistently throughout.