Allow deferred type error warnings to be suppressed
ClosedPublic

Authored by KaneTW on Apr 22 2015, 12:05 AM.

Details

Summary

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.

Test Plan

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
master
Lint
Lint WarningsExcuse: Hard to split up these lines
SeverityLocationCodeMessage
Warningcompiler/typecheck/TcErrors.hs:119TXT3Line Too Long
Warningcompiler/typecheck/TcErrors.hs:189TXT3Line Too Long
Warningcompiler/typecheck/TcErrors.hs:190TXT3Line Too Long
Warningtestsuite/tests/typecheck/should_compile/T10283.hs:18TXT3Line Too Long
Unit
No Unit Test Coverage
Build Status
Buildable 3843
Build 3873: GHC Patch Validation (amd64/Linux)
KaneTW updated this revision to Diff 2825.Apr 22 2015, 12:05 AM
KaneTW retitled this revision from to Allow deferred type error warnings to be suppressed.
KaneTW updated this object.
KaneTW edited the test plan for this revision. (Show Details)
KaneTW set the repository for this revision to rGHC Glasgow Haskell Compiler.
KaneTW added a project: GHC.
KaneTW updated the Trac tickets for this revision.
KaneTW updated this revision to Diff 2826.Apr 22 2015, 12:55 AM
KaneTW updated this object.
KaneTW edited edge metadata.
  • -fdefer-type-errors can now be suppressed (Trac #10283)
  • Fixes incorrect -w behavior in Trac #10283 implementation
KaneTW updated this revision to Diff 2827.Apr 22 2015, 1:27 AM
  • Restore order specificed in note [Always warn with -fdefer-type-errors] (Trac #10283)
KaneTW updated this revision to Diff 2828.Apr 22 2015, 2:13 AM
  • Fix maybeReportError logic in absence of -fno-warn-deferred-errors
nomeata accepted this revision.Apr 22 2015, 3:02 AM
nomeata added a reviewer: nomeata.
nomeata added a subscriber: nomeata.

Looks good to me, the new data type makes the code even prettier.

This revision is now accepted and ready to land.Apr 22 2015, 3:02 AM
KaneTW updated this revision to Diff 2833.Apr 22 2015, 3:11 PM
KaneTW edited edge metadata.

Great! I submitted a small patch that fixes some typos in the comments I made (it was getting pretty late :) )

simonpj accepted this revision.Apr 23 2015, 5:37 PM
simonpj added a reviewer: simonpj.
simonpj added a subscriber: simonpj.

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.

KaneTW updated this revision to Diff 2838.Apr 23 2015, 8:09 PM
KaneTW edited edge metadata.
austin accepted this revision.May 22 2015, 8:15 AM
austin edited edge metadata.

LGTM

It seems this is ready to land, no?

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.

bgamari requested changes to this revision.Jun 23 2015, 3:00 AM
bgamari added a reviewer: bgamari.

@KaneTW, if you fix the documentation issues I'd be happy to land this.

This revision now requires changes to proceed.Jun 23 2015, 3:00 AM
KaneTW updated this revision to Diff 3341.Jun 27 2015, 12:12 AM
KaneTW edited edge metadata.
KaneTW marked an inline comment as done.
  • Fixed documentation issues for deferred type error warnings
KaneTW marked 3 inline comments as done.Jun 27 2015, 12:13 AM

I fixed the issues Simon found.

austin accepted this revision.Jun 30 2015, 12:03 PM
austin edited edge metadata.
bgamari accepted this revision.Jul 3 2015, 5:28 AM
bgamari edited edge metadata.

Alright, the masses have spoken. I'll go ahead and merge this.

This revision is now accepted and ready to land.Jul 3 2015, 5:28 AM
bgamari requested changes to this revision.Jul 3 2015, 11:53 AM
bgamari edited edge metadata.

@KaneTW, I'm afraid there are some validation errors here. Perhaps you have a look?

This revision now requires changes to proceed.Jul 3 2015, 11:53 AM

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'
KaneTW updated this revision to Diff 3400.Jul 3 2015, 7:51 PM
KaneTW edited edge metadata.

Rebased against master and merged commits into one

thomie accepted this revision.Jul 4 2015, 6:50 PM
thomie added a reviewer: thomie.

It validates.

bgamari accepted this revision.Jul 5 2015, 11:58 AM
bgamari edited edge metadata.

Looks good. I'll land it.

This revision is now accepted and ready to land.Jul 5 2015, 11:58 AM
hvr accepted this revision.Jul 7 2015, 6:08 AM
hvr added a reviewer: hvr.
This revision was automatically updated to reflect the committed changes.