summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Test for undef bugs in the LLVM backend when validatingReid Barton2016-01-272-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | In an attempt to catch bugs involving using undef values, replace undef literals by values likely to cause crashes or test failures. We do this only when validating since it is a deoptimization. This depends on D1857 to catch such bugs in the RTS (such as #11487). Test Plan: Did a build with ``` BuildFlavour = quick-llvm SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage ``` The build crashed when running ghc-stage2, as expected. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1858
* Restore original alignment for info tablesSimon Brenner2016-01-273-4/+24
| | | | | | | | | | | | | | | | | | | | This was broken in 4a32bf925b8aba7885d9c745769fe84a10979a53, meaning that info tables and subsequent code are no longer guaranteed to have the recommended alignment. Split up the section header and section alignment printers, and print an appropriate alignment directive before each info table. Fixes Trac #11486 Reviewers: austin, bgamari, rwbarton Reviewed By: bgamari, rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1847 GHC Trac Issues: #11486
* ghci: fix trac issue #11481Benjamin Bykowski2016-01-271-1/+1
| | | | | | | | | | | | Test Plan: validate Reviewers: thomie, austin, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1833 GHC Trac Issues: #11481
* Typos in commentsGabor Greif2016-01-273-3/+3
|
* Fix a typo in the note name in commentsBartosz Nitka2016-01-273-9/+8
| | | | | | | | | | | | | | | | | This is `subsititution` to `substitution`, plus one instance of the note that I missed. Test Plan: docufix Reviewers: simonpj, bgamari, austin, goldfire Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1856 GHC Trac Issues: #11371
* Enable RemoteGHCi on WindowsTamar Christina2016-01-272-29/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the needed changes to make RemoteGHCi work on Windows. The approach passes OS Handles areound instead of the Posix Fd as on Linux. The reason is that I could not find any real documentation about the behaviour of Windows w.r.t inheritance and Posix FDs. The implementation with Fd did not seem to be able to find the Fd in the child process. Instead I'm using the much better documented approach of passing inheriting handles. This requires a small modification to the `process` library. https://github.com/haskell/process/pull/52 Test Plan: ./validate On Windows x86_64 Reviewers: thomie, erikd, bgamari, simonmar, austin, hvr Reviewed By: simonmar Subscribers: #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D1836 GHC Trac Issues: #11100
* 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-265-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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 two cloning-related bugsSimon Peyton Jones2016-01-262-41/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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.
* Implement -Wunrecognised-warning-flagBen Gamari2016-01-251-4/+18
| | | | | | | | | | | | | | | | | 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
* Rename -Wmissing-monadfail-instance to plural-formHerbert Valerio Riedel2016-01-252-5/+5
| | | | | | | | | | | | | | | | | | | 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
|
* Fix exprIsHNF (Trac #11248)Simon Peyton Jones2016-01-251-14/+17
| | | | | | | | | | | | | | | 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-252-10/+9
| | | | | | | | 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-253-69/+94
| | | | | | | | | 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-254-32/+81
| | | | | | | | | | | | | | | 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-242-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* 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
* Remove -Wredundant-superclasses from standard warningsBen Gamari2016-01-231-1/+0
| | | | | 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
* 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
* Default non-canonical CallStack constraintsEric Seidel2016-01-223-9/+10
| | | | | | | | | | | | | | | | Test Plan: `make test TEST=T11462` Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1804 GHC Trac Issues: #11462
* Improve comments in CmmSwitchJoachim Breitner2016-01-211-17/+22
| | | | | | | addressing some valuable feedback by thomie at https://phabricator.haskell.org/rGHCde1160be0477 Differential Revision: https://phabricator.haskell.org/D1816
* TyCoRep: Restore compatibility with 7.10.1Ben Gamari2016-01-211-1/+9
| | | | | | | | | | | | | | | | | | | | | Sadly CallStack wasn't present in 7.10.1, breaking the build when bootstrapping from this version. This patch essentially disables CallStack support for stage1 builds with 7.10.*. This doesn't seem so unreasonable though as stage2 will still work. Test Plan: Validate with 7.10.1 Reviewers: gridaphobe, jstolarek, austin Reviewed By: jstolarek Subscribers: thomie, jstolarek Differential Revision: https://phabricator.haskell.org/D1812 GHC Trac Issues: #11472
* Allow implicit parameters in constraint synonymsSimon Peyton Jones2016-01-211-5/+27
| | | | | | | | This fixes Trac #11466. It went bad by accident in commit ffc21506894c7887d3620423aaf86bc6113a1071 Refactor tuple constraints
* Strip casts in checkValidInstHeadSimon Peyton Jones2016-01-212-37/+59
| | | | | | | | | This patch addresses Trac #11464. The fix is a bit crude (traverse the type to remove CastTys), but it's also simple. See Note [Casts during validity checking] in TcValidity
* Remove the check_lifted check in TcValiditySimon Peyton Jones2016-01-211-3/+14
| | | | | | | | | | | | | This patch fixes Trac #11465. The check_unlifted check really isn't necessary, as discussed in Trac #11120 comment:19. Removing it made just one test-suite change, in indexed-types/should_fail/T9357, by allowing type family F (a :: k1) :: k2 type instance F Int# = Int to be accepted. And indeed that seems entirely reasonable.
* Improve pretty-printing of UnivCoSimon Peyton Jones2016-01-211-4/+10
| | | | | We really need to know the UnivCoProvenance to make sense of UnivCos in debug output
* Comments onlySimon Peyton Jones2016-01-211-2/+2
|
* Re-add missing kind generalisationSimon Peyton Jones2016-01-215-28/+31
| | | | | | | | | | | | When splitting H98/GADT syntax in ConDecl we lost a key kind-generalisation step. I also renamed tcHsTyVarBndrs to tcExplicitTKBnders, by analogy with tcImplicitTkBndrs. This fixes Trac #11459. Merge to 8.0.
* Comments onlySimon Peyton Jones2016-01-211-0/+10
| | | | Re Trac #11051
* Add comments about tyCoVarsOfTypeSimon Peyton Jones2016-01-211-0/+28
| | | | | | See Note [Free variables of types]. Richard to check.
* MkId: Update OpenKind referenceBen Gamari2016-01-211-1/+2
|
* substTy to substTyUnchecked to fix Travis buildBartosz Nitka2016-01-204-9/+10
| | | | | | | | | | | | | This fixes the immediate problem from https://s3.amazonaws.com/archive.travis-ci.org/jobs/103319396/log.txt Test Plan: ./validate Reviewers: bgamari, austin, thomie Differential Revision: https://phabricator.haskell.org/D1802 GHC Trac Issues: #11371
* Rework derivation of type representations for wired-in thingsBen Gamari2016-01-2010-160/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously types defined by `GHC.Types` and `GHC.Prim` had their `Typeable` representations manually defined in `GHC.Typeable.Internals`. This was terrible, resulting in a great deal of boilerplate and a number of bugs due to missing or inconsistent representations (see #11120). Here we take a different tack, initially proposed by Richard Eisenberg: We wire-in the `Module`, `TrName`, and `TyCon` types, allowing them to be used in `GHC.Types`. We then allow the usual type representation generation logic to handle this module. `GHC.Prim`, on the other hand, is a bit tricky as it has no object code of its own. To handle this we instead place the type representations for the types defined here in `GHC.Types`. On the whole this eliminates several special-cases as well as a fair amount of boilerplate from hand-written representations. Moreover, we get full coverage of primitive types for free. Test Plan: Validate Reviewers: goldfire, simonpj, austin, hvr Subscribers: goldfire, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1774 GHC Trac Issues: #11120
* Use (&&) instead of `if` in Ix derivationBen Gamari2016-01-201-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | We were previously using `if` in the derivation of `Ix` instances. This interacts badly with RebindableSyntax as the typechecker doesn't infer the type of the argument we give to `tagToEnum#`. Previously we produced, `if (ch >= ah) then (ch <= bh) else False`. We now produce `(ch >= ah) && (ch <= bh)` Fixes #11396. Test Plan: Validate Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1797 GHC Trac Issues: #11396
* Oops. Add missing close-commentSimon Peyton Jones2016-01-201-0/+2
| | | | This fixes 514bac2 for Trac #11172. Sorry!
* Fix combineIdenticalAltsSimon Peyton Jones2016-01-201-17/+48
| | | | | | | | | | | | This long-standing bug in CoreUtils.combineIdenticalAlts was shown up by Trac #11172. The effect was that it returned a correct set of alternatives, but a bogus set of "impossible default constructors". That meant that we subsequently removed all the alternatives from a case, and hence ended up with a bogusly empty case that should not have been empty. See Note [Care with impossible-constructors when combining alternatives] in CoreUtils.
* Fix IfaceType generation for TyCons without TyVarsÖmer Sinan Ağacan2016-01-191-1/+7
| | | | | | | | | | | | | - This is only used for printing purposes (in :browse etc.). - Fixes #11266. Reviewers: goldfire, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1799 GHC Trac Issues: #11266
* Re-export ghc-boot:GHC.Serialized as SerializedSimon Marlow2016-01-191-0/+7
| | | | For backwards-compat with GHC 7.10.
* Check InScopeSet in substTy and provide substTyUncheckedBartosz Nitka2016-01-1920-51/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds sanity checks to `substTy` that implement: > when calling substTy subst ty it should be the case that the in-scope > set in the substitution is a superset of > * The free vars of the range of the substitution > * The free vars of ty minus the domain of the substitution and replaces violators with unchecked version. The violators were found by running the GHC test suite. This ensures that I can work on this incrementally and that what I fix won't be undone by some other change. It also includes a couple of fixes that I've already done. Test Plan: ./validate Reviewers: simonmar, goldfire, simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1792 GHC Trac Issues: #11371
* Typos in commentsGabor Greif2016-01-193-3/+3
|
* Hide derived OccNames from userBen Gamari2016-01-191-3/+5
| | | | | | | | | | | | | | | | | | | | This hides derived OccNames from the Names returned from runDeclsWithLocation and clarifies the documentation. This is done to ensure that these names (originating from, e.g., derived Generic instances and type representation bindings) don't show up in ghci output when run with `:set +t`. This fixes #11051. Test Plan: Validate with included tests Reviewers: austin Reviewed By: austin Subscribers: thomie, hvr Differential Revision: https://phabricator.haskell.org/D1794 GHC Trac Issues: #11051
* Switch from -this-package-key to -this-unit-id.Edward Z. Yang2016-01-195-44/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small cosmetic change, but we have to do a bit of work to actually support it: - Cabal submodule update, so that Cabal passes us -this-unit-id when we ask for it. This includes a Cabal renaming to be consistent with Unit ID, which makes ghc-pkg a bit more scrutable. - Build system is updated to use -this-unit-id rather than -this-package-key, to avoid deprecation warnings. Needs a version test so I resurrected the old test we had (sorry rwbarton!) - I've *undeprecated* -package-name, so that we are in the same state as GHC 7.10, since the "correct" flag will have only entered circulation in GHC 8.0. - I removed -package-key. Since we didn't deprecate -package-id I think this should not cause any problems for users; they can just change their code to use -package-id. - The package database is indexed by UNIT IDs, not component IDs. I updated the naming here. - I dropped the signatures field from ExposedModule; nothing was using it, and instantiatedWith from the package database field. - ghc-pkg was updated to use unit ID nomenclature, I removed the -package-key flags but I decided not to add any new flags for now. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: 23Skidoo, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1780