summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the typechecker to use ExpTypes.wip/exp-typesRichard Eisenberg2016-01-26130-1720/+2666
| | | | | | | | | | | | | | | | | | | | | The idea here is described in [wiki:Typechecker]. Briefly, this refactor keeps solid track of "synthesis" mode vs "checking" in GHC's bidirectional type-checking algorithm. When in synthesis mode, the expected type is just an IORef to write to. In addition, this patch does a significant reworking of RebindableSyntax, allowing much more freedom in the types of the rebindable operators. For example, we can now have `negate :: Int -> Bool` and `(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic is in tcSyntaxOp. This addresses tickets #11397, #11452, and #11458. Tests: typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458} th/T11452
* Fix some substitution InScopeSetsRichard Eisenberg2016-01-265-4/+9
|
* Construct in_scope set in mkTopTCvSubstBartosz Nitka2016-01-268-16/+23
| | | | | | | | | | | | | | | | | | | | The pre-condition on `mkTopTCvSubst` turned out to be wrong and not satisfied by any of the callers. I've fixed it, so that it constructs the in_scope set from the range of the substitution. `mkTopTCvSubst` was also unnecessarily general it is never called with `CoVars`, so I changed the type signature and added an assertion. Test Plan: ./validate --slow Reviewers: goldfire, simonpj, bgamari, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1801 GHC Trac Issues: #11371
* Split off -Wunused-type-variables from -Wunused-matchesRyanGlScott2016-01-2617-71/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, `-Wunused-matches` would fire whenever it detected unused type variables in a type family or data family instance. This can be annoying for users who wish to use type variable names as documentation, as being `-Wall`-compliant would mean that they'd have to prefix many of their type variable names with underscores, making the documentation harder to read. To avoid this, a new warning `-Wunused-type-variables` was created that only encompasses unused variables in family instances. `-Wunused-matches` reverts back to its role of only warning on unused term-level pattern names. Unlike `-Wunused-matches`, `-Wunused-type-variables` is not implied by `-Wall`. Fixes #11451. Test Plan: ./validate Reviewers: goldfire, ekmett, austin, hvr, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1825 GHC Trac Issues: #11451
* Fix segmentation fault when .prof file not writeableThomas Miedema2016-01-268-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | There are two ways to do retainer profiling. Quoting from the user's guide: 1. `+RTS -hr` "Breaks down the graph by retainer set" 2. `+RTS -hr<cc> -h<x>`, where `-h<x>` is one of normal heap profiling break-down options (e.g. `-hc`), and `-hr<cc> means "Restrict the profile to closures with retainer sets containing cost-centre stacks with one of the specified cost centres at the top." Retainer profiling writes to a .hp file, like the other heap profiling options, but also to a .prof file. Therefore, when the .prof file is not writeable for whatever reason, retainer profiling should be turned off completely. This worked ok when running the program with `+RTS -hr` (option 1), but a segfault would occur when using `+RTS -hr<cc> -h<x>`, with `x!=r` (option 2). This commit fixes that. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1849 GHC Trac Issues: #11489
* Nicer error on +RTS -hc without -rtsopts or -profThomas Miedema2016-01-261-4/+42
| | | | | | | | | | | | | | Before: * without -rtsopts: Most RTS options are disabled. Link with -rtsopts to enable them. * with -rtsopts: invalid heap profile option: -hc After: * the flag -hc requires the program to be built with -prof Copy `Note [OPTION_SAFE vs OPTION_UNSAFE]` from commit 8c7ad0bd. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1845
* Pass InScopeSet to substTy in lintTyAppBartosz Nitka2016-01-262-8/+25
| | | | | | | | | | | | | | | | | | | This is the fix proposed in #11371: ``` In other cases, we already have the in-scope set in hand. Example: in CoreLint.lintTyApp we find a call to substTyWith. But Lint carries an in-scope set, so it would be easy to pass it to substTyWith. ``` Test Plan: ./validate --slow (only pre-existing problems) Reviewers: simonpj, goldfire, austin, nomeata, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1820 GHC Trac Issues: #11371
* Fix three broken tests involving exceptionsSimon Peyton Jones2016-01-263-11/+9
| | | | See comment:16 in Trac #10712. The tests were wrong, not GHC!
* Update process submodule to 1.4.2.0 releaseHerbert Valerio Riedel2016-01-261-0/+0
| | | | | Most notably, this pulls in a feature needed for #11100 (remote ghci) windows-support
* Update transformers submodule to 0.5.1.0 releaseHerbert Valerio Riedel2016-01-261-0/+0
| | | | This shouldn't have any noticeable API changes for GHC
* Minor users-guide markup fixup [skip ci]Herbert Valerio Riedel2016-01-261-2/+2
|
* Missed plural renaming in user's guideHerbert Valerio Riedel2016-01-261-1/+1
| | | | | | Follow-up to 132c20894d102558cc8f3aee5bc289425d0ddb24 [skip ci]
* Fix two cloning-related bugsSimon Peyton Jones2016-01-263-41/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Crikey! Not just one but two bugs in type variable cloning, both dating from the days before PolyKinds. Both were shown up by Trac #11330. 1. In SetLevels, when floating a case expression we must clone its binders, *and* do so in a telescope-aware way, because the constructor may bind a kind variable that appears in the kind of a type variable. Instead of doing this (wrongly) by steam, call CoreSubst.cloneBndrs. I added Notes and did other refactoring at the same time. 2. It turned out that CoreSubst.cloneBndrs calls TyCoRep.cloneTyVarBndr, and that too was bogus! It didn't substitute in the kind of the TyVar being cloned. There was even a comment to say "variables can't appear in kinds". Thta hasn't been true for a long time now. Easily fixed. Interestingly, I then found that test dependent/should_compile/KindEqualities was emitting a new inexhaustive-pattern-match warning. Sure enough it was valid! So the lack of cloning in cloneTyVarBndr really was causing an observable bug; just one that we had not observed.
* Kill off zipTopTCvSubst in favour of zipOpenTCvSubstSimon Peyton Jones2016-01-267-32/+25
| | | | | | | | | | | | | | As Bartosz has discovered, the invariants for substitutions were wrong, and in particular the "mkTop...Subst" and "zipTop..Subst" functions were building substitutions that didn't obey even the old invariants. This patch kills of the bogus zipTopTCvSubst in favour of the more robust zipOpenTCvSubst. I tripped over this because my upcoming patch (concerning SetLevels, Trac #11330) triggered an ASSERT failure in the substitution well-formedness assertion in TyCoRep.
* Add "ticks-exhausted" commentSimon Peyton Jones2016-01-261-0/+7
| | | | | | | | This code deliberately builds a subtle negative-occurrence-of-data-type example, described in the paper, so with -O it'll give "simplifier ticks exhausted". This patch just adds a comment to explain.
* White space onlySimon Peyton Jones2016-01-261-2/+2
|
* Less verbose output for the in-scope setSimon Peyton Jones2016-01-261-1/+4
| | | | | | | With -dppr-debug the output for the (ofen-large) InScope set was overwhelming. This makes it smaller. Only affects debugging.
* Ensure that we don't produce code for pre-ARMv7 without barriersBen Gamari2016-01-254-15/+15
| | | | | | | | | | | | | | | | | | | | | | We are unable to produce load/store barriers for pre-ARMv7 targets. Phab:D894 added dummy cases to SMP.h for these barriers to prevent the build from failing under the assumption that there are no SMP-capable devices of this vintage. However, #10433 points out that it is more correct to simply set NOSMP for such targets. Tested By: rwbarton Test Plan: Validate Reviewers: erikd, rwbarton, austin Reviewed By: rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1704 GHC Trac Issues: #10433
* Implement -Wunrecognised-warning-flagBen Gamari2016-01-259-4/+50
| | | | | | | | | | | | | | | | | This allows the user to avoid warnings for warning flags that GHC doesn't recognise. See #11429 for details.. Test Plan: Validate with T11429[abc] tests Reviewers: austin, hvr Reviewed By: hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1830 GHC Trac Issues: #11429
* user-guide: Note order-dependence of flagsBen Gamari2016-01-251-0/+22
| | | | | | | | | | | | | | | This supplements the description previously added in 6400c7687223c5b2141176aa92f7ff987f61aba6. See #10560 for details. Test Plan: read it Reviewers: austin Subscribers: thomie, hvr Differential Revision: https://phabricator.haskell.org/D1831 GHC Trac Issues: #10560
* Better document behavior of -Wmissed-specialisationsBen Gamari2016-01-251-1/+2
| | | | | | | | | | Test Plan: Read it Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1829
* Rename -Wmissing-monadfail-instance to plural-formHerbert Valerio Riedel2016-01-258-14/+14
| | | | | | | | | | | | | | | | | | | This warning flag was recently introduced as part of #10751. However, it was missed during code-review that almost all existing warning flags use a plural-form, so for consistency this commit renames that warning flag to `-Wmissing-monadfail-instances`. Test Plan: local validate (still running) Reviewers: quchen, goldfire, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1842 GHC Trac Issues: #10751
* HscTypes: Fix typo in commentBen Gamari2016-01-251-1/+1
|
* Comments only: more alternate names for ARM registers [skip ci]Reid Barton2016-01-251-3/+4
| | | | | | | | | | | | | | Summary: These are the names used by arm-linux-androideabi-objdump, so it's helpful to have them here next to the Stg register mapping. Reviewers: austin, erikd, bgamari Reviewed By: erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1840
* Show error message for unknown symbol on Elf_Rel platformsReid Barton2016-01-251-1/+0
| | | | | | | | | | | | Summary: This is already the behavior on Elf_Rela platforms, and is helpful. Reviewers: simonmar, austin, bgamari, erikd Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1841
* Fix exprIsHNF (Trac #11248)Simon Peyton Jones2016-01-252-14/+20
| | | | | | | | | | | | | | | Blimey! CoreUtils.exprIsHNFlike had not one but two bugs. * is_hnf_like treated coercion args like type args (result: exprIsHNF might wrongly say True) * app_is_value treated type args like value args (result: exprIsHNF might wrongly say False) Bizarre. This goes back to at least 2012. It's amazing that it hasn't caused more trouble. It was discovered by a Lint error when compiling Trac #11248 with -O.
* Improve tracing in checkValidInstanceSimon Peyton Jones2016-01-251-1/+5
|
* Avoid recursive use of immSuperClassesSimon Peyton Jones2016-01-253-11/+10
| | | | | | | | In fixing Trac #11480 I had omitted to deal with FunDeps.oclose, which was making recursive use of immSuperClasses, and hence going into a loop in the recursive case. Solution: use transSuperClasses, which takes care not to.
* Refactor validity checking for type/data instancesSimon Peyton Jones2016-01-254-74/+100
| | | | | | | | | I found that there was some code duplication going on, so I've put more into the shared function checkValidFamPats. I did some refactoring in checkConsistentFamInst too, preparatory to #11450; the error messages change a little but no change in behaviour.
* Special-case implicit params in superclass expansionSimon Peyton Jones2016-01-258-32/+118
| | | | | | | | | | | | | | | This issue came up in Trac #11480, and is documented in Note [When superclasses help] in TcRnTypes. We were getting a spurious warning T11480.hs:1:1: warning: solveWanteds: too many iterations (limit = 4) The fix is easy. A bit of refactoring along the way. The original bug report in Trac #11480 appears to work fine in HEAD and the 8.0 branch but I added a regression test in this commit as well.
* Implement `-Wnoncanonical-monadfail-instances` warningHerbert Valerio Riedel2016-01-248-2/+151
| | | | | | | | | | | | | | | | | | | | | | | | The MonadFail proposal implemented so far via #10751 only warns about missing `MonadFail` instances based on existence of failible pattern matches in `do`-blocks. However, based on the noncanonical Monad warnings implemented via #11150 we can provide a different mechanism for detecting missing `MonadFail` instances quite cheaply. That is, by checking for canonical `fail` definitions. In the case of `Monad`/`MonadFail`, we define the canonical implementation of `fail` to be such that the soft-deprecated method shall (iff overridden) be defined in terms of the non-deprecated method. Consequently, in case of `MonadFail`, the `Monad(fail)` method shall be defined as alias of the `MonadFail(fail)` method. This allows us at some distant point in the future to remove `fail` from the `Monad` class, while having GHC ignore/tolerate such literal canonical method definitions. Reviewed By: bgamari, RyanGlScott Differential Revision: https://phabricator.haskell.org/D1838
* Add -fwarn-redundant-constrains to test for #9708Thomas Miedema2016-01-242-0/+9
| | | | | | | | Fixes validate on Travis. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1834
* Remove `replaceDynFlags` from `ContainsDynFlags`Thomas Miedema2016-01-245-19/+14
| | | | | | | | | | Refactoring only. It's shorter, and brings `HasDynFlags/ContainsDynFLags` in line with `HasModule/ContainsModule`. Introduce `updTopEnv`. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1832
* Docs: delete section on Hierarchical ModulesThomas Miedema2016-01-242-40/+0
| | | | | | | | | This information is mostly useless, since hierarchical modules are valid Haskell2010 and everybody knows how to use them. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1835
* User's guide: fix singular/plural typo in flagnamesHerbert Valerio Riedel2016-01-241-4/+4
|
* Add test for #11473Ben Gamari2016-01-232-0/+21
|
* user-guide: Document -L RTS flagBen Gamari2016-01-231-7/+12
| | | | See #5641.
* Don't add ticks around type applications (#11329)Reid Barton2016-01-231-4/+10
| | | | | | | | | | | | Test Plan: validate --slow Reviewers: austin, bgamari, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1824
* user-guide: Fix typosBen Gamari2016-01-231-2/+2
|
* user-guide: Reformat warning listsBen Gamari2016-01-231-12/+31
|
* mkUserGuidePart: Better flag cross-referencingBen Gamari2016-01-239-89/+94
|
* Remove -Wredundant-superclasses from standard warningsBen Gamari2016-01-233-7/+2
| | | | | It is impossible to write warning-free code under the three-release policy with this flag enabled by default. See #11370 for details.
* Give a more verbose error message when desugaring a HsTypeOutReid Barton2016-01-231-1/+5
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1826
* Small doc fixAdam Sandberg Eriksson2016-01-231-7/+7
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1828
* Remove unused IND_PERMJoachim Breitner2016-01-2319-115/+39
| | | | | | | | | | | | | | | | | it seems that this closure type has not been in use since 5d52d9, so all this is dead and untested code. This removes it. Some of the code might be useful for a counting indirection as described in #10613, so when implementing that, have a look at what this commit removes. Test Plan: validate on harbormaster Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1821
* Add test for Trac #11056RyanGlScott2016-01-232-0/+15
| | | | | | | | | | | | Reviewers: thomie, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton Differential Revision: https://phabricator.haskell.org/D1823 GHC Trac Issues: #11056
* rts: Disable tick timer unless really neededBen Gamari2016-01-221-3/+8
| | | | | | | | | | | | | | | | | | | | | | Trac #9105 notes significant CPU usage by an otherwise idle process when compiled with profiling. The reason for this is that we keep the tick timer active in the profiling RTS even if profiling wasn't requested at runtime. If the user requests any sort of profiling then we need to keep the timer active to ensure that samples are collected. Test Plan: Validate, check CPU usage, ensure profiling still works Reviewers: simonmar, austin Reviewed By: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1822 GHC Trac Issues: #9105
* Do not count void arguments when considering a function for loopification.Jonas Scholl2016-01-222-17/+46
| | | | | | | | | | | | | | | | | | | | | | | This fixes #11372 by omitting arguments with a void-type when checking whether a self-recursive tail call can be optimized to a local jump. Previously, a function taking a real argument and a State# token would report an arity of 1 in the SelfLoopInfo in getCallMethod, but a self-recursive call would apply it to 2 arguments, one of them being the State# token, thus no local jump would be generated. As the State# token is not represented by anything at runtime, we can ignore it and thus trigger the loopification optimization. Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: simonmar, thomie Differential Revision: https://phabricator.haskell.org/D1767 GHC Trac Issues: #11372
* Fix a formatting error in the user's guideEric Seidel2016-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | ``` ``CallStack``s ``` seems to confuse ReST into producing an extended code-span ``` ``CallStack``\s ``` fixes it, but there may be a better solution Test Plan: build the user's guide and inspect the last paragraph of "9.14.4.5. Implicit CallStacks" Reviewers: bgamari Reviewed By: bgamari Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1798
* Mark some ghci tests as req_interpReid Barton2016-01-221-3/+3
| | | | | | | | | | | | Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1819