Adds a flag -fwarn-deferred-type-errors similar to -fwarn-typed-holes.
Changes the boolean flag of -fdefer-type-errors to a 3-state flag similar to the one used by -fdefer-typed-holes/-fwarn-typed-holes.
Details
Since only the absence of deferred type error warnings when -fno-warn-deferred-type-errors is passed has to be tested, I duplicated a test case checking -fdefer-type-errors and adjusted it accordingly.
Diff Detail
- Repository
- rGHC Glasgow Haskell Compiler
- Branch
- deferred
- Lint
Lint Warnings Excuse: Hard to break up these lines Severity Location Code Message Warning compiler/typecheck/TcErrors.hs:119 TXT3 Line Too Long Warning compiler/typecheck/TcErrors.hs:170 TXT3 Line Too Long Warning compiler/typecheck/TcErrors.hs:171 TXT3 Line Too Long Warning compiler/typecheck/TcErrors.hs:189 TXT3 Line Too Long Warning compiler/typecheck/TcErrors.hs:190 TXT3 Line Too Long Warning testsuite/tests/typecheck/should_compile/T10283.hs:18 TXT3 Line Too Long - Unit
No Unit Test Coverage - Build Status
Buildable 4581 Build 4617: GHC Patch Validation (amd64/Linux)
- -fdefer-type-errors can now be suppressed (Trac #10283)
- Fixes incorrect -w behavior in Trac #10283 implementation
- Restore order specificed in note [Always warn with -fdefer-type-errors] (Trac #10283)
Great! I submitted a small patch that fixes some typos in the comments I made (it was getting pretty late :) )
Fits in very nicely. I like the similarit with HoleChoice. A couple of suggestions above
compiler/typecheck/TcErrors.hs | ||
---|---|---|
168 | Better data TypeErrorChoice -- What to do for type errors found by the type checker = TypeError -- A type error aborts compilation with an error message | TypeWarn -- A type error is deferred to runtime, plus a compile-time warning | TypeDefer -- A type error is deferred to runtime; no error or warning at compile time | |
docs/users_guide/flags.xml | ||
1702 | It's on by default, right? We should say so. |
Good, land it. I have made a couple of minor suggestions about documentation.
docs/users_guide/glasgow_exts.xml | ||
---|---|---|
9107 | I would say "suppress" rather than "prevent" | |
docs/users_guide/using.xml | ||
1161 | "until" not "unto". Saying "Does nothing unless..." doesn't seem to add anything; but the cross-reference is helpful. Say that it is enabled by default. |
That's weird, the previous commits validated fine and I only changed documentation. I'll take a look.
I'll run a validate on my local machine but I'm not quite sure what happened there. It seems like the patch only got partially applied?
compiler/typecheck/TcErrors.hs:177:6: Warning: 15 Defined but not used: type constructor or class `TypeErrorChoice' 16 17 compiler/typecheck/TcErrors.hs:178:5: Warning: 18 Defined but not used: data constructor `TypeError' 19 20 compiler/typecheck/TcErrors.hs:179:5: Warning: 21 Defined but not used: data constructor `TypeWarn' 22 23 compiler/typecheck/TcErrors.hs:180:5: Warning: 24 Defined but not used: data constructor `TypeDefer'