summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Add note documenting refineDefaultAltMatthew Pickering2018-05-131-0/+88
| | | | | | | | | | Reviewers: sjakobi, bgamari Reviewed By: sjakobi Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4687
* GHCi: Include a note in the hint to expose a hidden packageChaitanya Koparkar2018-05-131-1/+2
| | | | | | | | | | | | | | Test Plan: validate Reviewers: bgamari, RyanGlScott, osa1 Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15055 Differential Revision: https://phabricator.haskell.org/D4669
* Remove unused things from utils/DigraphDavid Feuer2018-05-131-89/+2
| | | | | | | | | | | | | | | | | `utils/Digraph` had a bunch of code that wasn't actually being used, much of which wasn't documented at all, some of which was clearly ill-considered, and some of which was documented as being inefficient. Remove all unused code from that module except for the obvious and innocuous `emptyG`. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4676
* Refactor LitStringSylvain Henry2018-05-135-81/+83
| | | | | | | | | | | | | | | | | | Refactor LitString so that the string length is computed at most once and then stored. Also remove strlen and memcmp wrappers (it seems like they were a workaround for a very old GCC when using -fvia-C). Bumps haddock submodule. Reviewers: bgamari, dfeuer, nickkuk Reviewed By: bgamari, nickkuk Subscribers: nickkuk, dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4630
* TcInteract: Ensure that tycons have representations before solving for TypeableBen Gamari2018-05-133-1/+9
| | | | | | | | | | | | Summary: This fixes #15067. Test Plan: Validate Subscribers: thomie, carter, RyanGlScott GHC Trac Issues: #15067 Differential Revision: https://phabricator.haskell.org/D4623
* Simplify -ddump-json implementationMatthew Pickering2018-05-133-73/+25
| | | | | | | | | | | | | | | | | | | This patch takes the much simpler route of whenever the compiler tries to output something. We just dump a JSON document there and then. I think this should be sufficient to work with and anything more refined quickly got complicated as it was necessary to demarcate message scopes and so on. Reviewers: bgamari, dfeuer Reviewed By: bgamari Subscribers: Phyx, dfeuer, rwbarton, thomie, carter GHC Trac Issues: #14078 Differential Revision: https://phabricator.haskell.org/D4532
* Emit info-level log message when package envs are loadedHerbert Valerio Riedel2018-05-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | A common complaint with the new package environment files feature is that it's not obvious when package environments have been picked up. This patch applies the same strategy that was already used for `.ghci` files (which exhibit similar potential for confusion, c.f. #11389) to package environment files. For instance, this new notification looks like below for a GHCi invocation which loads both, a GHCi configuration as well as a package environment: GHCi, version 8.5.20180512: http://www.haskell.org/ghc/ :? for help Loaded package environment from /tmp/parsec-3.1.13.0/.ghc.environment.x86_64-linux-8.5.20180512 Loaded GHCi configuration from /home/hvr/.ghci Prelude> Addresses #15145 Reviewed By: bgamari, angerman GHC Trac Issues: #15145 Differential Revision: https://phabricator.haskell.org/D4689
* Use correct source spans for EmptyCaseRyan Scott2018-05-121-2/+3
| | | | | | | | | | | | | | | | | | | Summary: The parser's calculation of source spans for `EmptyCase` expressions was a bit off, leading to some wonky-looking error messages. Easily fixed with some uses of `comb3` and `sLL`. Test Plan: make test TEST=T15139 Reviewers: bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, mpickering, carter GHC Trac Issues: #15139 Differential Revision: https://phabricator.haskell.org/D4685
* Expand $tooldir in ghc --info outputAlp Mestanogullari2018-05-122-6/+13
| | | | | | | | | | | | | | | | | | | | | Summary: This requires adding an `sToolDir :: Maybe FilePath` field to Settings, since compilerInfo is pure and therefore needs to have all the information available in the DynFlags. This should fix #15101 and #15107. Test Plan: ./validate --fast Reviewers: Phyx, bgamari Reviewed By: Phyx Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15101, #15107 Differential Revision: https://phabricator.haskell.org/D4686
* Revert "Add -fghci-leak-check to check for space leaks"Simon Marlow2018-05-101-2/+0
| | | | This reverts commit 5fe6aaa3756cda654374ebfd883fa8f064ff64a4.
* Fix #15038Ömer Sinan Ağacan2018-05-103-8/+40
| | | | | | | | | | | | | | | | | | | | | We introduce a new Id for unused pointer values in unboxed sums that is not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY definitions CAFFY, fixing #15038. To make sure anything referenced by the new id will be retained we get a stable pointer to in on RTS startup. Test Plan: Passes validate Reviewers: simonmar, simonpj, hvr, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4680
* Add -fghci-leak-check to check for space leaksSimon Marlow2018-05-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Space leaks in GHCi emerge from time to time and tend to come back again after they get fixed. This is an attempt to limit regressions by * adding a reliable detection for some classes of space leaks in GHCi * turning on leak checking for all GHCi tests in the test suite, so that we'll notice if the leak appears again. The idea for detecting space leaks is quite simple: * find some data that we expect to be GC'd later, make a weak pointer to it * when we expect the data to be dead, do a `performGC` and then check the status of the weak pointer. It would be nice to apply this trick to lots of things in GHC, e.g. ensuring that HsSyn is not retained after the desugarer, or ensuring that CoreSyn from the previous simplifier pass is not retained. Test Plan: validate Reviewers: bgamari, simonpj, erikd, niteria Subscribers: thomie, carter GHC Trac Issues: #15111 Differential Revision: https://phabricator.haskell.org/D4658
* Normalize the element type of ListPat, fix #14547HE, Tao2018-05-081-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624
* Revert "Normalize the element type of ListPat, fix #14547"Ben Gamari2018-05-081-4/+1
| | | | This reverts commit 981bf4718de7daef7817a363ccc14030c2688632.
* Normalize the element type of ListPat, fix #14547Ben Gamari2018-05-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624
* Revert "Normalize the element type of ListPat, fix #14547"Ben Gamari2018-05-081-4/+1
| | | | This reverts commit 361d23a8ebb44f5df5167306d7b98d8bd1724e06.
* Simplify the kind checking for type/class declsSimon Peyton Jones2018-05-081-103/+129
| | | | | This patch deletes quite a bit of code, AND fixes Trac #15116.
* Used named fields for DataDeclRnSimon Peyton Jones2018-05-081-3/+6
|
* Small refactoring in ExitifySimon Peyton Jones2018-05-081-60/+73
| | | | | This refactoring was provoked by our conversation on Trac #14152. No change in behaviour.
* Add 'addWordC#' PrimOpSebastian Graf2018-05-058-14/+96
| | | | | | | | | | | | | | | | | | | This is mostly for congruence with 'subWordC#' and '{add,sub}IntC#'. I found 'plusWord2#' while implementing this, which both lacks documentation and has a slightly different specification than 'addWordC#', which means the generic implementation is unnecessarily complex. While I was at it, I also added lacking meta-information on PrimOps and refactored 'subWordC#'s generic implementation to be branchless. Reviewers: bgamari, simonmar, jrtc27, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, thomie, carter Differential Revision: https://phabricator.haskell.org/D4592
* Do not supply `-mcpu` if `-optlc` provides `-mcpu` already.Moritz Angermann2018-05-051-2/+3
| | | | | | | | | | Reviewers: bgamari Subscribers: thomie, carter GHC Trac Issues: #14982 Differential Revision: https://phabricator.haskell.org/D4548
* Normalize the element type of ListPat, fix #14547HE, Tao2018-05-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The element type of `List` maybe a type family instacen, rather than a trivial type. For example in Trac #14547, ``` {-# LANGUAGE TypeFamilies, OverloadedLists #-} class Foo f where type It f foo :: [It f] -> f data List a = Empty | a :! List a deriving Show instance Foo (List a) where type It (List a) = a foo [] = Empty foo (x : xs) = x :! foo xs ``` Here the element type of `[]` is `It (List a)`, we should also normalize it as `a`. Test Plan: make test TEST="T14547" Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14547 Differential Revision: https://phabricator.haskell.org/D4624
* Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module.klebinger.andreas@gmx.at2018-05-058-370/+438
| | | | | | | | | | | | | | | | | | Splitting TrieMap into a general and core specific part allows us to define instances for TrieMap without creating a transitive dependency on CoreSyn. Test Plan: ci Reviewers: goldfire, bgamari, simonmar, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, nomeata, thomie, carter GHC Trac Issues: #15082 Differential Revision: https://phabricator.haskell.org/D4618
* Simplify callSiteInline a littleSimon Peyton Jones2018-05-041-17/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has virtually no effect on anything (according to a nofib run). But it simplifies the definition of interesting_call by being a bit less gung-ho about inlining nested function bindings. See Note [Nested functions] ----------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem ----------------------------------------------------------------------- anna +0.2% -0.0% 0.163 0.163 0.0% binary-trees +0.1% +0.0% -4.5% -4.5% 0.0% cacheprof -0.1% +0.1% -4.7% -4.8% +2.7% fasta +0.2% 0.0% +2.6% +3.0% 0.0% fluid -0.0% -0.6% 0.011 0.011 0.0% gamteb -0.1% -0.0% 0.069 0.070 0.0% hpg +0.1% +0.0% +0.7% +0.7% 0.0% infer +0.3% +0.2% 0.097 0.098 0.0% lambda -0.1% -0.0% +2.0% +2.0% 0.0% n-body +0.1% -0.1% -0.1% -0.1% 0.0% simple -0.2% -0.2% +0.6% +0.6% 0.0% spectral-norm +0.1% -0.0% -0.1% -0.1% 0.0% tak -0.0% -0.1% 0.024 0.024 0.0% -------------------------------------------------------------------------------- Min -0.4% -0.6% -5.3% -5.3% 0.0% Max +0.3% +0.2% +3.3% +3.3% +15.0% Geometric Mean -0.0% -0.0% -0.3% -0.3% +0.2%
* GHCi: Improve the error message for hidden packagesChaitanya Koparkar2018-05-031-3/+7
| | | | | | | | | | | | | | Test Plan: make test TEST=T15055 Reviewers: bgamari, RyanGlScott, osa1, Iceland_jack Reviewed By: osa1 Subscribers: ulysses4ever, thomie, carter GHC Trac Issues: #15055 Differential Revision: https://phabricator.haskell.org/D4621
* Correctly add unwinding info in manifestSp and makeFixupBlocksBartosz Nitka2018-05-033-37/+122
| | | | | | | | | | | | | | | | | | | | | | | | In `manifestSp` the unwind info was before the relevant instruction, not after. I added some notes to establish semantics. Also removes redundant annotation in stg_catch_frame. For `makeFixupBlocks` it looks like we were off by `wORD_SIZE dflags`. I'm not sure why, but it lines up with `manifestSp`. In fact it lines up so well so that I can consolidate the Sp unwind logic in `maybeAddUnwind`. I detected the problems with `makeFixupBlocks` by running T14779b after patching D4559. Test Plan: added a new test Reviewers: bgamari, scpmw, simonmar, erikd Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #14999 Differential Revision: https://phabricator.haskell.org/D4606
* Compute DW_FORM_block length correctly; also fixes #15068Bertram Felgenhauer2018-05-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, the pprUnwindwExpr function computed the length of by the following assembly fragment: .uleb128 1f-.-1 <expression data> 1: That is, to compute the length, it takes the difference of the label 1 and the address of the .uleb128 directive, and subtracts 1. In #15068 it was reported that `as` from binutils 4.30 has trouble with evaluating the `.` part of the expression. However, there is actually a problem with the expression, if the length of the data ever becomes larger than 128: In that case, the .uleb128 directive will emit more than 1 byte, and the computed length will be wrong. The present patch changes the assembly fragment to use two labels, which fixes both these problems. .uleb128 2f-1f 1: <expression data> 2: Test Plan: validate Reviewers: bgamari, osa1 Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15068 Differential Revision: https://phabricator.haskell.org/D4654
* Set arity for absentErrorDavid Feuer2018-05-021-20/+23
| | | | | | | | | | | | | | | | | | * The note on how to prevent stable unfoldings from leading to `case` on `absentError` was wrong. Make it reflect reality. * Reviewing the above change, Simon noticed that we didn't set an arity for `absentError`, which definitely has arity 1. It may not matter much, since `absentError` usually vanishes quickly, but we might as well set it properly, so now we do. Reviewers: simonpj, bgamari Reviewed By: simonpj Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4655
* Exitify: Do not trip over shadowing (fixes #15110)Joachim Breitner2018-05-011-4/+19
|
* Preserve join-point arity in CoreOptSimon Peyton Jones2018-05-011-2/+21
| | | | | | | | Trac #15108 showed that the simple optimiser in CoreOpt was accidentally eta-reducing a join point, so it didn't meet its arity invariant. This patch fixes it. See Note [Preserve join-binding arity].
* Don't crash when pretty-printing bad joinsSimon Peyton Jones2018-05-011-1/+9
| | | | | | | | | | Trac #15108 showed that the Core pretty-printer would crash if it found a join-point binding with too few lambda on the RHS. That is super-unhelpful! Lint will find it, but pretty-printing should not crash. This patch just makes the pretty printer behave more robustly; it leaves the job of error reporting to Lint.
* Better linting for typesSimon Peyton Jones2018-04-272-74/+99
| | | | | | | | | | Trac #15057 described deficiencies in the linting for types involving type synonyms. This patch fixes an earlier attempt. The moving parts are desrcribed in Note [Linting type synonym applications] Not a big deal.
* Make out-of-scope errors more prominentSimon Peyton Jones2018-04-271-3/+15
| | | | | | | | | | | | | | | | | | | | | | Generally, when the type checker reports an error, more serious ones suppress less serious ones. A "variable out of scope" error is arguably the most serious of all, so this patch moves it to the front of the list instead of the end. This patch also fixes Trac #14149, which had -fdefer-out-of-scope-variables, but also had a solid type error. As things stood, the type error was not reported at all, and compilation "succeeded" with error code 0. Yikes. Note that - "Hole errors" (including out of scope) are never suppressed. (maybeReportHoleError vs maybeReportError in TcErorrs) They can just get drowned by the noise. - But with the new orientation, out of scope errors will suppress type errors. That would be easy to change.
* Refactor tcExtendLocalFamInst a bitSimon Peyton Jones2018-04-272-30/+47
| | | | | | | This patch just pulls out FamInst.loadDependentFamInstModules as a separate function, and adds better comments. Provoked by Trac #14759, comment:10.
* Comments only: the FVAnn invariantSimon Peyton Jones2018-04-271-6/+19
|
* Minor refactoring in ExitifySimon Peyton Jones2018-04-271-32/+39
| | | | | | No change in behaviour here, just some modest refactoring as I tried to understand the code better.
* TTG : complete for balance of hsSyn ASTAlan Zimmerman2018-04-2758-1739/+2863
| | | | | | | | | | | | | | | | | | Summary: - remove PostRn/PostTc fields - remove the HsVect In/Out distinction for Type, Class and Instance - remove PlaceHolder in favour of NoExt - Simplify OutputableX constraint Updates haddock submodule Test Plan: ./validate Reviewers: goldfire, bgamari Subscribers: goldfire, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4625
* Rename a local variableSimon Peyton Jones2018-04-271-2/+2
|
* Refactor in OccurAnalSimon Peyton Jones2018-04-271-28/+29
| | | | | | | | | * (+++) --> andUDs * combineAltsUsageDetails --> orUDs * combineUsageDetailsList --> andUDsList * Change some andUDsList to a fold for efficiency No change in behaviour
* Comments onlySimon Peyton Jones2018-04-272-2/+3
|
* Do not unpack class dictionaries with INLINABLESimon Peyton Jones2018-04-262-28/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Matthew Pickering uncovered a bad performance hole in the way that single-method dictionaries work, described in Trac #14955. See Note [Do not unpack class dictionaries] in WwLib. I tried to fix this 6 years ago, but got it slightly wrong. This patch fixes it, which makes a dramatic improvement in the test case. Nofib highlights: not much happening: Program Size Allocs Runtime Elapsed TotalMem ----------------------------------------------------------------- VSM -0.3% +2.7% -7.4% -7.4% 0.0% cacheprof -0.0% +0.1% +0.3% +0.7% 0.0% integer -0.0% +1.1% +7.5% +7.5% 0.0% tak -0.1% -0.2% 0.024 0.024 0.0% ----------------------------------------------------------------- Min -4.4% -0.2% -7.4% -7.4% -8.0% Max +0.6% +2.7% +7.5% +7.5% 0.0% Geom Mean -0.1% +0.0% +0.1% +0.1% -0.2% I investigated VSM. The patch unpacks class dictionaries a bit more than before (i.e. does so if there is no INLINABLE pragma). And that gives better code in VSM (less dictionary selection etc), but one closure gets one word bigger. I'll accept these changes in exchange for more robust performance. Some ghci.debugger output wobbled around (order of bindings being displayed). I have no idea why; but I accepted the changes.
* coercion: Improve debugging outputSimon Peyton Jones2018-04-231-36/+46
| | | | | | | | | | | * Improve assertion-failure message * Add HasDebugCallStack to decomposeFunCo Reviewers: goldfire, bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4570
* Remove unnecessary check in simplCastTobias Dammers2018-04-201-4/+8
| | | | | | | | | | | | | The coercion optimizer will take care of it anyway, and the check is prohibitively expensive. See Trac #14737. Reviewers: bgamari Subscribers: simonpj, thomie, carter Differential Revision: https://phabricator.haskell.org/D4568
* Fix implementation of rnIfaceBndrMatthew Pickering2018-04-201-1/+1
| | | | | | | | | | | | Reviewers: ezyang, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15041 Differential Revision: https://phabricator.haskell.org/D4600
* comments onlySimon Peyton Jones2018-04-201-4/+4
|
* Inline wrappers earlierSimon Peyton Jones2018-04-201-53/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has a single significant change: strictness wrapper functions are inlined earlier, in phase 2 rather than phase 0. As shown by Trac #15056, this gives a better chance for RULEs to fire. Before this change, a function that would have inlined early without strictness analyss was instead inlining late. Result: applying "optimisation" made the program worse. This does not make too much difference in nofib, but I've stumbled over the problem more than once, so even a "no-change" result would be quite acceptable. Here are the headlines: -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- cacheprof -0.5% -0.5% +2.5% +2.5% 0.0% fulsom -1.0% +2.6% -0.1% -0.1% 0.0% mate -0.6% +2.4% -0.9% -0.9% 0.0% veritas -0.7% -23.2% 0.002 0.002 0.0% -------------------------------------------------------------------------------- Min -1.4% -23.2% -12.5% -15.3% 0.0% Max +0.6% +2.6% +4.4% +4.3% +19.0% Geometric Mean -0.7% -0.2% -1.4% -1.7% +0.2% * A worthwhile reduction in binary size. * Runtimes are not to be trusted much but look as if they are moving the right way. * A really big win in veritas, described in comment:1 of Trac #15056; more fusion rules fired. * I investigated the losses in 'mate' and 'fulsom'; see #15056.
* Caching coercion roles in NthCo and coercionKindsRole refactoringTobias Dammers2018-04-2020-331/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While addressing nonlinear behavior related to coercion roles, particularly `NthCo`, we noticed that coercion roles are recalculated often even though they should be readily at hand already in most cases. This patch adds a `Role` to the `NthCo` constructor so that we can cache them rather than having to recalculate them on the fly. https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the approach. Performance improvement over GHC HEAD, when compiling Grammar.hs (see below): GHC 8.2.1: ``` ghc Grammar.hs 176.27s user 0.23s system 99% cpu 2:56.81 total ``` before patch (but with other optimizations applied): ``` ghc Grammar.hs -fforce-recomp 175.77s user 0.19s system 100% cpu 2:55.78 total ``` after: ``` ../../ghc/inplace/bin/ghc-stage2 Grammar.hs 10.32s user 0.17s system 98% cpu 10.678 total ``` Introduces the following regressions: - perf/compiler/parsing001 (possibly false positive) - perf/compiler/T9872 - perf/compiler/haddock.base Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11735 Differential Revision: https://phabricator.haskell.org/D4394
* Lint types in newFamInstRyan Scott2018-04-192-31/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We weren't linting the types used in `newFamInst`, which might have been why #15012 went undiscovered for so long. Let's fix that. One has to be surprisingly careful with expanding type synonyms in `lintType`, since in the offending program (simplified): ```lang=haskell type FakeOut a = Int type family TF a type instance TF Int = FakeOut a ``` If one expands type synonyms, then `FakeOut a` will expand to `Int`, which masks the issue (that `a` is unbound). I added an extra Lint flag to configure whether type synonyms should be expanded or not in Lint, and disabled this when calling `lintTypes` from `newFamInst`. As evidence that this works, I ran it on the offending program from #15012, and voilà: ``` $ ghc3/inplace/bin/ghc-stage2 Bug.hs -dcore-lint [1 of 1] Compiling Foo ( Bug.hs, Bug.o ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.5.20180417 for x86_64-unknown-linux): Core Lint error <no location info>: warning: In the type ‘... (Rec0 (FakeOut b_a1Qt))))’ @ b_a1Qt is out of scope ``` Test Plan: make test TEST=T15057 Reviewers: simonpj, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15057 Differential Revision: https://phabricator.haskell.org/D4611
* Fix #15012 with a well-placed use of AnyRyan Scott2018-04-191-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, derived `Generic1` instances could have associated `Rep1` type family instances with unbound variables, such as in the following example: ```lang=haskell data T a = MkT (FakeOut a) deriving Generic1 type FakeOut a = Int ==> instance Generic1 T where type Rep1 T = ... (Rec0 (FakeOut a)) ``` Yikes! To avoid this, we simply map the last type variable in a derived `Generic1` instance to `Any`. Test Plan: make test TEST=T15012 Reviewers: bgamari Reviewed By: bgamari Subscribers: simonpj, thomie, carter GHC Trac Issues: #15012 Differential Revision: https://phabricator.haskell.org/D4602
* Better error message for empty character literal, for Trac #13450.HE, Tao2018-04-191-10/+48
| | | | | | | | | | | | | | | | | For empty character literal, the `''`, report error message properly rather than just throw a "parser error" with wrong error location. Test Plan: make test TEST="T13450 T13450TH" Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering, carter GHC Trac Issues: #13450 Differential Revision: https://phabricator.haskell.org/D4594