summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Comment out a pprTraceRyan Scott2018-07-051-1/+1
| | | | | | | This was introduced in commit 45f44e2c9d5db2f25c52abb402f197c20579400f, but it results in lots of "check_class ~" messages when validating. I've decided to just comment it out.
* Make ppr_tc_args aware of -fprint-explicit-kindsRyan Scott2018-07-051-2/+6
| | | | | | | | | | | | | | | | | | Summary: `ppr_tc_args` was printing invisible kind arguments even when `-fprint-explicit-kinds` wasn't enabled. Easily fixed. Test Plan: make test TEST=T15341 Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15341 Differential Revision: https://phabricator.haskell.org/D4932
* Fix #15331 with careful blasts of parenthesizeHsTypeRyan Scott2018-07-054-5/+9
| | | | | | | | | | | | | | | | | | Summary: Another `-ddump-splices` bug that can be solved with more judicious use of parentheses. Test Plan: make test TEST=T15331 Reviewers: goldfire, bgamari, alanz, tdammers Reviewed By: tdammers Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15331 Differential Revision: https://phabricator.haskell.org/D4920
* Parenthesize rank-n contexts in ConvertRyan Scott2018-07-051-1/+3
| | | | | | | | | | | | | | | | Summary: A simple oversight. Test Plan: make test TEST=T15324 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15324 Differential Revision: https://phabricator.haskell.org/D4910
* Fix newtype instance GADTsRyan Scott2018-07-051-9/+43
| | | | | | | | | | | | | | | | | | | | | Summary: This was taken from Richard's branch, which in turn was submitted to Phab by Matthew, which in turn was commandeered by Ryan. This fixes an issue with newtype instances in which too many coercions were being applied in the worker. This fixes the issue by removing the data family instance axiom from the worker and moving to the wrapper. Moreover, we now require all newtype instances to have wrappers, for symmetry with data instances. Reviewers: goldfire, bgamari, simonpj, mpickering Reviewed By: mpickering Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15318 Differential Revision: https://phabricator.haskell.org/D4902
* Instantiate GND bindings with an explicit type signatureRyan Scott2018-07-053-24/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before, we were using visible type application to apply impredicative types to `coerce` in `GeneralizedNewtypeDeriving`-generated bindings. This approach breaks down when combined with `QuantifiedConstraints` in certain ways, which #14883 and #15290 provide examples of. See Note [GND and QuantifiedConstraints] for all the gory details. To avoid this issue, we instead use an explicit type signature to instantiate each GND binding, and use that to bind any type variables that might be bound by a class method's type signature. This reduces the need to impredicative type applications, and more importantly, makes the programs from #14883 and #15290 work again. Test Plan: make test TEST="T15290b T15290c T15290d T14883" Reviewers: simonpj, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14883, #15290 Differential Revision: https://phabricator.haskell.org/D4895
* Fix #15308 by suppressing invisble args more rigorouslyRyan Scott2018-07-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: There was a buglet in `stripInvisArgs` (which is part of the pretty-printing pipeline for types) in which only invisble arguments which came before any visible arguments would be suppressed, but any invisble arguments that came //after// visible ones would still be printed, even if `-fprint-explicit-kinds` wasn't enabled. The fix is simple: make `stripInvisArgs` recursively process the remaining types even after a visible argument is encountered. Test Plan: make test TEST=T15308 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15308 Differential Revision: https://phabricator.haskell.org/D4891
* Fix #15307 by making nlHsFunTy parenthesize moreRyan Scott2018-07-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: `nlHsFunTy` wasn't parenthesizing its arguments at all, which led to `-ddump-deriv` producing incorrectly parenthesized types (since it uses `nlHsFunTy` to construct those types), as demonstrated in #15307. Fix this by changing `nlHsFunTy` to add parentheses à la `ppr_ty`: always parenthesizing the argument type with function precedence, and recursively processing the result type, adding parentheses for each function type it encounters. Test Plan: make test TEST=T14578 Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15307 Differential Revision: https://phabricator.haskell.org/D4890
* Refactor validity checking for constraintsSimon Peyton Jones2018-07-056-658/+789
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several changes here. * TcInteract has gotten too big, so I moved all the class-instance matching out of TcInteract into a new module ClsInst. It parallels the FamInst module. The main export of ClsInst is matchGlobalInst. This now works in TcM not TcS. * A big reason to make matchGlobalInst work in TcM is that we can then use it from TcValidity.checkSimplifiableClassConstraint. That extends checkSimplifiableClassConstraint to work uniformly for built-in instances, which means that we now get a warning if we have givens (Typeable x, KnownNat n); see Trac #15322. * This change also made me refactor LookupInstResult, in particular by adding the InstanceWhat field. I also changed the name of the type to ClsInstResult. Then instead of matchGlobalInst reporting a staging error (which is inappropriate for the call from TcValidity), we can do so in TcInteract.checkInstanceOK. * In TcValidity, we now check quantified constraints for termination. For example, this signature should be rejected: f :: (forall a. Eq (m a) => Eq (m a)) => blah as discussed in Trac #15316. The main change here is that TcValidity.check_pred_help now uses classifyPredType, and has a case for ForAllPred which it didn't before. This had knock-on refactoring effects in TcValidity.
* Fix commentSimon Peyton Jones2018-07-041-1/+1
|
* Add comments on Typeable (n :: Nat)Simon Peyton Jones2018-07-042-3/+25
| | | | | See Note [Typeable for Nat and Symbol] in TcInteract, which I added after discussion on Trac #15322
* Fix errors caused by invalid candidates leaking from hole fitsMatthías Páll Gissurarson2018-07-041-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | This is a one line fix (and a note) that fixes four tickets, #15007, #15321 and #15202, #15314 The issue was that errors caused by illegal candidates (according to GHC stage or being internal names) were leaking to the user, causing bewildering error messages. If a candidate causes the type checker to error, it is not a valid hole fit, and should be discarded. As mentioned in #15321, this can cause a pattern of omissions, which might be hard to discover. A better approach would be to gather the error messages, and ask users to report them as GHC bugs. This will be implemented in a subsequent change. Reviewers: bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15007, #15321, #15202, #15314 Differential Revision: https://phabricator.haskell.org/D4909
* Fix nptr field alignment in RtClosureInspectÖmer Sinan Ağacan2018-07-041-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | `extractSubTerms` (which is extracting pointer and non-pointer fields of a closure) was computing the alignment incorrectly when aligning a 64-bit value (e.g. a Double) on i386 by aligning it to 64-bits instead of to word size (32-bits). This is documented in `mkVirtHeapOffsetsWithPadding`: > Align the start offset (eg, 2-byte value should be 2-byte aligned). > But not more than to a word. Fixes #15061 Test Plan: Validated on both 32-bit and 64-bit. 32-bit fails with various unrelated stat failures, but no actual test failures. Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15061 Differential Revision: https://phabricator.haskell.org/D4906
* RtClosureInspect: add some docs, remove unused stuffÖmer Sinan Ağacan2018-07-041-71/+58
| | | | | | | | | | | | Details are not documented, only the high-level functions Reviewers: simonpj, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4911
* Fix mkGadtDecl does not set con_forall correctlyAlan Zimmerman2018-06-291-1/+1
| | | | | | | | | | | | A GADT declaration surrounded in parens does not det the con_forall field correctly. e.g. data MaybeDefault v where TestParens :: (forall v . (Eq v) => MaybeDefault v) Closes #15323
* A few typofixes in commentsGabor Greif2018-06-295-5/+5
|
* Clarify role of coercion in flattening functionRichard Eisenberg2018-06-281-1/+2
| | | | Comments only: [ci skip]
* Add commnent about binder orderSimon Peyton Jones2018-06-261-4/+15
| | | | ...provoked by Trac #15308
* Typofixes in comments and whitespace only [ci skip]Gabor Greif2018-06-264-10/+10
|
* Remove dead codeSimon Peyton Jones2018-06-261-12/+0
|
* A bit more tc-tracking in TcUnify.uUnfilledVarSimon Peyton Jones2018-06-261-4/+10
|
* Fix TcLevel manipulation in TcDerivInfer.simplifyDerivSimon Peyton Jones2018-06-263-64/+101
| | | | | | | | | | | | | | | | | | The level numbers we were getting simply didn't obey the invariant (ImplicInv) in TcType Note [TcLevel and untouchable type variables] That leads to chaos. Easy to fix. I improved the documentation. I also added an assertion in TcSimplify that checks that level numbers go up by 1 as we dive inside implications, so that we catch the problem at source rather than than through its obscure consequences. That in turn showed up that TcRules was also generating constraints that didn't obey (ImplicInv), so I fixed that too. I have no idea what consequences were lurking behing that bug, but anyway now it's fixed. Hooray.
* API Annotations when parsing typappAlan Zimmerman2018-06-261-2/+2
| | | | | | | Make sure the original annotations are still accessible for a promoted type. Closes #15303
* Record some notes about "innocuous" transformationsSimon Peyton Jones2018-06-252-1/+75
| | | | | | | | | | | | I wondered if some transformations (ticks) might be "innocuous", in the sense that they do not unlock a later transformation that does not occur in the same pass. If so, we could refrain from bumping the overall tick-count for such innocuous transformations, and perhaps terminate the simplifier one pass earlier. BUt alas I found that virtually nothing was innocuous! This commit just adds a Note to record what I learned, in case anyone wants to try again.
* Remove unused BottomFound from TickSimon Peyton Jones2018-06-251-3/+0
|
* More misc commentsSimon Peyton Jones2018-06-253-10/+15
| | | | | ... plus, reorder equations in toIfaceVar to improve legibility. No change in behaviour.
* Coments and debug tracing onlySimon Peyton Jones2018-06-251-0/+4
| | | | See Trac #15205
* Refactor the kind-checking of tyvar bindersSimon Peyton Jones2018-06-253-126/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The refactoring here is driven by the ghastly mess described in comment:24 of Trac #1520. The overall goal is to simplify the kind-checking of typev-variable binders, and in particular to narrow the use of the "in-scope tyvar binder" stuff, which is needed only for associated types: see the new Note [Kind-checking tyvar binders for associated types] in TcHsType. Now * The "in-scope tyvar binder" stuff is done only in - kcLHsQTyVars, which is used for the LHsQTyVars of a data/newtype, or type family declaration. - tcFamTyPats, which is used for associated family instances; it now calls tcImplicitQTKBndrs, which in turn usese newFlexiKindedQTyVar * tcExpicitTKBndrs (which is used only for function signatures, data con signatures, pattern synonym signatures, and expression type signatures) now does not go via the "in-scope tyvar binder" stuff at all. While I'm still not happy with all this code, the code is generally simpler, and I think this is a useful step forward. It does cure the problem too. (It's hard to trigger the problem in vanilla Haskell code, because the renamer would normally use different names for nested binders, so I can't offer a test.)
* Improve tc-tracing a bitSimon Peyton Jones2018-06-252-1/+5
|
* Fix error recovery for pattern synonymsSimon Peyton Jones2018-06-253-28/+81
| | | | | | | | | As Trac #15289 showed, we were carrying on after a type error in a pattern synonym, and then crashing. This patch improves error handling for pattern synonyms. I also moved a bit of code from TcBinds into TcPatSyn, which helpfully narrows the API.
* Tweak API Annotations for ConDeclGADTAlan Zimmerman2018-06-242-7/+7
|
* Remove -Wamp flagroland2018-06-221-3/+0
| | | | | | | | | | | | | | Test Plan: "ghc -Wamp XXX.hs" should give "unrecognised warning flag" Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11477 Differential Revision: https://phabricator.haskell.org/D4785
* TTG for IPBind had wrong extension nameAlan Zimmerman2018-06-227-11/+11
| | | | | | | | | | | | | | | | | | | | The standard[1] for extension naming is to use the XC prefix for the internal extension points, rather than for a new constructor. This is violated for IPBind, having data IPBind id = IPBind (XIPBind id) (Either (Located HsIPName) (IdP id)) (LHsExpr id) | XCIPBind (XXIPBind id) Swap the usage of XIPBind and XCIPBind [1] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow#Namingconventions Closes #15302
* Move a Note to the module that refers to itSimon Peyton Jones2018-06-222-13/+13
|
* Remove unnecessary call to checkReductionDepthSimon Peyton Jones2018-06-221-1/+2
| | | | | We call checkReductionDepth in chooseInstance, so there's no need to call it in selectNextWorkItem too
* Refactor try_solve_fromInstance in shortCutSolverSimon Peyton Jones2018-06-221-15/+15
| | | | | | This patch just removes the CtLoc parameter from trySolveFromInstance, since it can just as easily (and more uniformly) be gotten from the CtEvidence it is trying to solve.
* Instances in no-evidence implicationsSimon Peyton Jones2018-06-225-107/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trac #15290 showed that it's possible that we might attempt to use a quantified constraint to solve an equality in a situation where we don't have anywhere to put the evidence bindings. This made GHC crash. This patch stops the crash, but still rejects the pogram. See Note [Instances in no-evidence implications] in TcInteract. Finding this bug revealed another lurking bug: * An infelicity in the treatment of superclasses -- we were expanding them locally at the leaves, rather than at their binding site; see (3a) in Note [The superclass story]. As a consequence, TcRnTypes.superclassesMightHelp must look inside implications. In more detail: * Stop the crash, by making TcInteract.chooseInstance test for the no-evidence-bindings case. In that case we simply don't use the instance. This entailed a slight change to the type of chooseInstance. * Make TcSMonad.getPendingScDicts (now renamed getPendingGivenScs) return only Givens from the /current level/; and make TcRnTypes.superClassesMightHelp look inside implications. * Refactor the simpl_loop and superclass-expansion stuff in TcSimplify. The logic is much easier to understand now, and has less duplication.
* Drop redundant NoteRyan Scott2018-06-211-20/+1
| | | | | | Richard added a much better version of this Note in commit 26e9806ada8823160dd63ca2c34556e5848b2f45, so I've decided to point to that instead.
* containers: Bump to 0.6.0.1Ben Gamari2018-06-201-1/+1
| | | | Bumps containers submodule, among others.
* Fix gcc.exe: error: CreateProcess: No such file or directoryMoritz Angermann2018-06-204-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | When GHC links binaries on windows, we pass a -L and -l flag to gcc for each dependency in the transitive dependency closure. As this will usually overflow the command argument limit on windows, we use response files to pass all arguments to gcc. gcc however internally passes only the -l flags via a response file to the collect2 command, but puts the -L flags on the command line. As such if we pass enough -L flags to gcc--even via a response file--we will eventually overflow the command line argument length limit due to gcc passing them to collect2 without resorting to a response file. To prevent this from happening we move all lirbaries into a shared temporary folder, and only need to pass a single -L flag to gcc. Ideally however this was fixed in gcc. Reviewers: bgamari, Phyx Reviewed By: bgamari Subscribers: erikd, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4762
* Remove HsEqTy and XEqTyRyan Scott2018-06-206-44/+4
| | | | | | | | | | | | | | | | | | | | | After commit d650729f9a0f3b6aa5e6ef2d5fba337f6f70fa60, the `HsEqTy` constructor of `HsType` is essentially dead code. Given that we want to remove `HsEqTy` anyway as a part of #10056 (comment:27), let's just rip it out. Bumps the haddock submodule. Test Plan: ./validate Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #10056 Differential Revision: https://phabricator.haskell.org/D4876
* Allow :info for (~) in GHCiRyan Scott2018-06-201-1/+3
| | | | | | | | | | | | | | | | | | | `(~)` is not an identifier according to GHC's parser, which is why GHCi's `:info` command wouldn't work on it. To rectify this, we apply the same fix that was put in place for `(->)`: add `(~)` to GHC's `identifier` parser production. Test Plan: make test TEST=T10059 Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, mpickering, carter GHC Trac Issues: #10059 Differential Revision: https://phabricator.haskell.org/D4877
* A few more typofixes in docs/comments [ci skip]Gabor Greif2018-06-204-4/+4
|
* Revert "containers: Bump to 0.6.0.1"Ben Gamari2018-06-191-1/+1
| | | | | | | | This reverts commit 50e7bff7514ebbd74976c1a9fa0db7a8275178ae. Reverts submodule changes. Sigh, the haskeline commit isn't quite upstream yet.
* containers: Bump to 0.6.0.1Ben Gamari2018-06-191-1/+1
| | | | Bumps containers submodule, among others.
* Document and simplify tcInstTyBindersRichard Eisenberg2018-06-193-30/+108
| | | | This fixes #15282.
* Fix API Annotations for GADT constructorsAlan Zimmerman2018-06-196-32/+42
| | | | | | | | | | | | | | | | | | | Summary: This patch completes the work for #14529 by making sure that all API Annotations end up attached to a SrcSpan that appears in the final ParsedSource. Updates Haddock submodule Test Plan: ./validate Reviewers: goldfire, bgamari Subscribers: rwbarton, thomie, mpickering, carter GHC Trac Issues: #14529 Differential Revision: https://phabricator.haskell.org/D4867
* Adjust comments (Trac #14164)Simon Peyton Jones2018-06-191-2/+2
|
* Fix typo in comment onlyRichard Eisenberg2018-06-181-1/+1
| | | | [skip ci]
* Typofixes in docs and comments [ci skip]Gabor Greif2018-06-1817-21/+21
|