summaryrefslogtreecommitdiff
path: root/testsuite
Commit message (Collapse)AuthorAgeFilesLines
* Improve output from -ddump-typesSimon Peyton Jones2018-10-2458-146/+40
| | | | | | | | | | | | | | | | | | This patch makes a number of improvements to the output generated by -ddump-types * Prints data constructor separately * Omits empty chunks of output I was driven initially by the unhelpful existing output for data constructors, but ended up doing some refactoring. Lots of error message wibbles, but nothing significant. Certainly no change in user behaviour. (NB: It is just possible that I have failed to cleanly separate this patch from the next one, about isPredTy and friends.)
* Fix #15792 by not reifying invisible arguments in AppTysRyan Scott2018-10-243-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The `reifyType` function in `TcSplice` is carefully designed to avoid reifying visible arguments to `TyConApp`s. However, the same care was not given towards the `AppTy` case, which lead to #15792. This patch changes to the `AppTy` case of `reifyType` so that it consults the kind of the function type to determine which of the argument types are invisible (and therefore should be dropped) during reification. This required crafting a variant of `tyConArgFlags`, which I dubbed `appTyArgFlags`, that accept an arbitrary function `Type` instead of a `TyCon`. Test Plan: make test TEST=T15792 Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, carter GHC Trac Issues: #15792 Differential Revision: https://phabricator.haskell.org/D5252
* Keep top-level names in typed TH quotes aliveRyan Scott2018-10-243-0/+14
| | | | | | | | | | | | | | | | | | | | Summary: When renaming untyped TH quotes, some care is taken to ensure that uses of top-level names in quotes do not have their bindings discarded during desugaring. The same care was not applied to typed TH quotes, so this patch brings the two into sync. Test Plan: make test TEST=T15783 Reviewers: bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, carter GHC Trac Issues: #15783 Differential Revision: https://phabricator.haskell.org/D5248
* Fix #15781 by using ktypedocs on type synonym RHSesRyan Scott2018-10-244-16/+57
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow-up to D5173, which permitted unparenthesized kind signatures in certain places. One place that appeared to be overlooked was the right-hand sides of type synonyms, which this patch addresses by introducing a `ktypedoc` parser production (which is to `ctypdoc` as `ktype` is to `ctype`) and using it in the right place. Test Plan: make test TEST="KindSigs T15781" Reviewers: harpocrates, bgamari Reviewed By: harpocrates Subscribers: rwbarton, mpickering, carter GHC Trac Issues: #15781 Differential Revision: https://phabricator.haskell.org/D5245
* Trigger multiline mode in GHCi on '\case' (#13087)Alec Theriault2018-10-245-0/+30
| | | | | | | | | | | | | | | | | | | Summary: In ALR, 'ITlcase' should expect an opening curly. This is probably a forgotten edge case in ALR, since `maybe_layout` (which handles the non-ALR layout) already deals with the 'ITlcase' token properly. Test Plan: make TEST=T10453 && make TEST=T13087 Reviewers: bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, carter GHC Trac Issues: #10453, #13087 Differential Revision: https://phabricator.haskell.org/D5236
* Update hsc2hs submodule to work around bug in response file handling.klebinger.andreas@gmx.at2018-10-224-0/+15
| | | | | | | | | | | | | | | | | | | | Summary: This works around #15758 by bumping hsc2hs. The new version includes support for response files independent of the boot compiler. Test Plan: ci, building formerly broken packages Reviewers: bgamari, RyanGlScott, ckoparkar Reviewed By: ckoparkar Subscribers: rwbarton, carter GHC Trac Issues: #15758 Differential Revision: https://phabricator.haskell.org/D5250
* Fix T15729 in masterZejun Wu2018-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: It failed when running ./validate on master T15729 is added by me in D5219 recently, it failed when GHCi is dynamicly linked: ``` Stderr ( T15729 ): /bin/ld.gold: error: bss.o: requires unsupported dynamic reloc 11; recompile with -fPIC collect2: error: ld returned 1 exit status `gcc' failed in phase `Linker'. (Exit code: 1) ``` Test Plan: Both tests pass now. Reviewers: simonmar, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5235
* testsuite: Fix non-canonical Monoid instance in T3001-2Ben Gamari2018-10-171-1/+1
|
* Fix #15761 by adding parensRichard Eisenberg2018-10-173-0/+11
| | | | | | This was just a pretty-printer infelicity. Fixed now. Test case: printer/T15761
* Allocate bss section within proper range of other sectionsZejun Wu2018-10-155-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocate bss section within proper range of other sections: * when `+RTS -xp` is passed, allocate it contiguously as we did for jump islands * when we mmap the code to lower 2Gb, we should allocate bss section there too This depends on {D5195} Test Plan: 1. `./validate` 2. with ``` DYNAMIC_GHC_PROGRAMS = NO DYNAMIC_BY_DEFAULT = NO ``` `TEST="T15729" make test` passed in both linux and macos. 3. Also test in a use case where we used to encouter error like: ``` ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) = b90282ba ``` and now, everything works fine. Reviewers: simonmar, bgamari, angerman, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15729 Differential Revision: https://phabricator.haskell.org/D5219
* Enable -Wcompat=error in the testsuiteVladislav Zavialov2018-10-15301-796/+1277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enabling -Werror=compat in the testsuite allows us to easily see the impact that a new warning has on code. It also means that in the period between adding the warning and making the actual breaking change, all new test cases that are being added to the testsuite will be forwards-compatible. This is good because it will make the actual breaking change contain less irrelevant testsuite updates. Things that -Wcompat warns about are things that are going to break in the future, so we can be proactive and keep our testsuite forwards-compatible. This patch consists of two main changes: * Add `TEST_HC_OPTS += -Werror=compat` to the testsuite configuration. * Fix all broken test cases. Test Plan: Validate Reviewers: hvr, goldfire, bgamari, simonpj, RyanGlScott Reviewed By: goldfire, RyanGlScott Subscribers: rwbarton, carter GHC Trac Issues: #15278 Differential Revision: https://phabricator.haskell.org/D5200
* Generate correct relocation for external cost centreZejun Wu2018-10-155-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to always generate direct access for cost centre labels. We fixed this by generating indirect data load for cost centre defined in external module. Test Plan: The added test used to fail with error message ``` /bin/ld.gold: error: T15723B.o: requires dynamic R_X86_64_PC32 reloc against 'T15723A_foo1_EXPR_cc' which may overflow at runtime; recompile with -fPIC ``` and now passes. Also check that `R_X86_64_PC32` is generated for CostCentre from the same module and `R_X86_64_GOTPCREL` is generated for CostCentre from external module: ``` $ objdump -rdS T15723B.o 0000000000000028 <T15723B_test_info>: 28: 48 8d 45 f0 lea -0x10(%rbp),%rax 2c: 4c 39 f8 cmp %r15,%rax 2f: 72 70 jb a1 <T15723B_test_info+0x79> 31: 48 83 ec 08 sub $0x8,%rsp 35: 48 8d 35 00 00 00 00 lea 0x0(%rip),%rsi # 3c <T15723B_test_info+0x14> 38: R_X86_64_PC32 T15723B_test1_EXPR_cc-0x4 3c: 49 8b bd 60 03 00 00 mov 0x360(%r13),%rdi 43: 31 c0 xor %eax,%eax 45: e8 00 00 00 00 callq 4a <T15723B_test_info+0x22> 46: R_X86_64_PLT32 pushCostCentre-0x4 4a: 48 83 c4 08 add $0x8,%rsp 4e: 48 ff 40 30 incq 0x30(%rax) 52: 49 89 85 60 03 00 00 mov %rax,0x360(%r13) 59: 48 83 ec 08 sub $0x8,%rsp 5d: 49 8b bd 60 03 00 00 mov 0x360(%r13),%rdi 64: 48 8b 35 00 00 00 00 mov 0x0(%rip),%rsi # 6b <T15723B_test_info+0x43> 67: R_X86_64_GOTPCREL T15723A_foo1_EXPR_cc-0x4 6b: 31 c0 xor %eax,%eax 6d: e8 00 00 00 00 callq 72 <T15723B_test_info+0x4a> 6e: R_X86_64_PLT32 pushCostCentre-0x4 72: 48 83 c4 08 add $0x8,%rsp 76: 48 ff 40 30 incq 0x30(%rax) ``` Reviewers: simonmar, bgamari Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15723 Differential Revision: https://phabricator.haskell.org/D5214
* Fix #15738 by defining (and using) parenthesizeHsContextRyan Scott2018-10-153-0/+25
| | | | | | | | | | | | | | | | | | | | | With `QuantifiedConstraints`, `forall`s can appear in more nested positions than they could before, but `Convert` and the TH pretty-printer were failing to take this into account. On the `Convert` side, this is fixed by using a `parenthesizeHsContext` to parenthesize singleton quantified constraints that appear to the left of a `=>`. (A similar fix is applied to the TH pretty-printer.) Test Plan: make test TEST=T15738 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15738 Differential Revision: https://phabricator.haskell.org/D5222
* Fix #12430 by expanding type synonyms in injTyVarsOfTypeRyan Scott2018-10-153-0/+15
| | | | | | | | | | | | | | | | | | | We weren't expanding type synonyms when determining the injective type variables of a type, leading to certain non-injective families being mistakenly labeled as injective (#12430). Easily fixed with a tactical use of `coreView`. Test Plan: make test TEST=T12430 Reviewers: bgamari, goldfire Reviewed By: goldfire Subscribers: goldfire, rwbarton, carter GHC Trac Issues: #12430 Differential Revision: https://phabricator.haskell.org/D5228
* Surprising error message with bang patternSasa Bogicevic2018-10-156-2/+40
| | | | | | | | | | | | Reviewers: bgamari, alanz Reviewed By: bgamari Subscribers: sgraf, mpickering, rwbarton, thomie, carter GHC Trac Issues: #13600 Differential Revision: https://phabricator.haskell.org/D5040
* Typeable: Only render saturated tuple types with tuple syntaxBen Gamari2018-10-153-0/+13
| | | | | | | | | | | | | | | | | | This isn't as efficient as it could be since it needs to compute the kind of the type. However, this is `show` so there shouldn't be any particular expectation of speed. Fixes #14341. Test Plan: Validate Reviewers: hvr Subscribers: monoidal, rwbarton, carter GHC Trac Issues: #14341 Differential Revision: https://phabricator.haskell.org/D5080
* Fix plugin tests requirementsTamar Christina2018-10-153-7/+51
| | | | | | | | | | | | | | | | | | | | Unfortunately the implementation has confused the ability to make dynamic libraries with dynamic way. This constraint is only true for systems that require `-fPIC` for shared libraries. Since the implementation has this implicit assumption, mark the tests as requiring dynway. Test Plan: ./validate Reviewers: bgamari Reviewed By: bgamari Subscribers: simonpj, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5174
* Fix #15725 with an extra SymRyan Scott2018-10-152-0/+75
| | | | | | | | | | | | | | | | | | | | Summary: We were adding a `Sym` to one argument in the `InstCo` case of `optCoercion` but not another, leading to the two arguments to misaligned when combined via `Trans`. This fixes the issue with a well targeted use of `wrapSym`. Test Plan: make test TEST=T15725 Reviewers: goldfire, ningning, bgamari Reviewed By: goldfire, ningning Subscribers: rwbarton, carter GHC Trac Issues: #15725 Differential Revision: https://phabricator.haskell.org/D5217
* Add RubbishLit for absent bindings of UnliftedRepSebastian Graf2018-10-143-0/+363
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Trac #9279 reminded us that the worker wrapper transformation copes really badly with absent unlifted boxed bindings. As `Note [Absent errors]` in WwLib.hs points out, we can't just use `absentError` for unlifted bindings because there is no bottom to hide the error in. So instead, we synthesise a new `RubbishLit` of type `forall (a :: TYPE 'UnliftedRep). a`, which code-gen may subsitute for any boxed value. We choose `()`, so that there is a good chance that the program crashes instead instead of leading to corrupt data, should absence analysis have been too optimistic (#11126). Reviewers: simonpj, hvr, goldfire, bgamari, simonmar Reviewed By: simonpj Subscribers: osa1, rwbarton, carter GHC Trac Issues: #15627, #9279, #4306, #11126 Differential Revision: https://phabricator.haskell.org/D5153
* Include -fwarn-star-is-type in -WcompatVladislav Zavialov2018-10-122-1/+10
| | | | | | | | | | | | | | | | | According to the deprecation schedule in the accepted proposal, the first step is to include `-fwarn-star-is-type` in `-Wcompat`. Test Plan: Validate Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15476 Differential Revision: https://phabricator.haskell.org/D5044
* Support builtin classes like KnownNat in backpackPiyush P Kurur2018-10-113-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit allows backpack signatures to enforce constraints like KnownNat on data types. Thus it fixes #15379. There were two important differences in the way GHC used to handle classes like KnowNat 1. Hand crafted instances of `KnownNat` were forbidden, and 2. The dictionary for an instance `KnownNat T` was generated on the fly. For supporting backpack both these points have to be revisited. Disallowing instances of KnownNat -------------------------------------------- Users were disallowed to declare instances of certain builtin classes like KnownNat for obvious safety reasons --- when we use the constraint like `KnownNat T`, we want T to be associated to a natural number. However, due to the reuse of this code while processing backpack signatures, `instance KnownNat T` were being disallowed even in module signature files. There is an important difference when it comes to instance declarations in a signature file. Consider the signature `Abstract` given below ``` signature Abstract where data T :: Nat instance KnownNat T ``` Inside a signature like `Abstract`, the `instance Known T` is not really creating an instance but rather demanding any module that implements this signature to enforce the constraint `KnownNat` on its type T. While hand crafted KnownNat instances continued to be prohibited in modules, this commit ensures that it is not forbidden while handling signatures. Resolving Dictionaries ---------------------------- Normally GHC expects any instance `T` of class `KnownNat` to eventually resolve to an integer and hence used to generate the evidence/dictionary for such instances on the fly as in when it is required. However, when backpack module and signatures are involved It is not always possible to resolve the type to a concrete integer utill the mixin stage. To illustrate consider again the signature `Abstract` > signature Abstract where > data T :: Nat > instance KnownNat T and a module `Util` that depends on it: > module Util where > import Abstract > printT :: IO () > printT = do print $ natVal (Proxy :: Proxy T) Clearly, we need to "use" the dictionary associated with `KnownNat T` in the module `Util`, but it is too early for the compiler to produce a real dictionary as we still have not fixed what `T` is. Only when we mixin a concrete module > module Concrete where > type T = 42 do we really get hold of the underlying integer. In this commit, we make the following changes in the resolution of instance dictionary for constraints like `KnownNat T` 1. If T is indeed available as a type alias for an integer constant, generate the dictionary on the fly as before, failing which 2. Do not give up as before but look up the type class environment for the evidence. This was enough to make the resolution of `KnownNat` dictionaries work in the setting of Backpack as when actual code is generated, the signature Abstract (due to the `import Abstract` ) in `Util` gets replaced by an actual module like Concrete, and resolution happens as before. Everything that we said for `KnownNat` is applicable for `KnownSymbol` as well. Reviewers: bgamari, ezyang, goldfire, simonpj Reviewed By: simonpj Subscribers: simonpj, ezyang, rwbarton, thomie, carter GHC Trac Issues: #15379 Differential Revision: https://phabricator.haskell.org/D4988
* Re-enable test T14251Ömer Sinan Ağacan2018-10-101-2/+1
| | | | (This change was accidentally reverted with the previous commit)
* Fix dataToTag# argument evaluationÖmer Sinan Ağacan2018-10-1010-22/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | See #15696 for more details. We now always enter dataToTag# argument (done in generated Cmm, in StgCmmExpr). Any high-level optimisations on dataToTag# applications are done by the simplifier. Looking at tag bits (instead of reading the info table) for small types is left to another diff. Incorrect test T14626 is removed. We no longer do this optimisation (see comment:44, comment:45, comment:60). Comments and notes about special cases around dataToTag# are removed. We no longer have any special cases around it in Core. Other changes related to evaluating primops (seq# and dataToTag#) will be pursued in follow-up diffs. Test Plan: Validates with three regression tests Reviewers: simonpj, simonmar, hvr, bgamari, dfeuer Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15696 Differential Revision: https://phabricator.haskell.org/D5201
* Revert "Add Int8# and Word8#"Ben Gamari2018-10-0918-691/+0
| | | | | | | | | This unfortunately broke i386 support since it introduced references to byte-sized registers that don't exist on that architecture. Reverts binary submodule This reverts commit 5d5307f943d7581d7013ffe20af22233273fba06.
* update amd64 linux/osx stats for haddock.base perf testAlp Mestanogullari2018-10-091-1/+2
| | | | | | | | | | | | | This perf test is regularly failing (e.g with a deviation of 5.1% on a recent harbormaster build), this patch addresses the failure. Test Plan: TEST=haddock.base ./validate Reviewers: bgamari Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5215
* Add Int8# and Word8#Michal Terepeta2018-10-0718-0/+691
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step of implementing: https://github.com/ghc-proposals/ghc-proposals/pull/74 The main highlights/changes: - `primops.txt.pp` gets two new sections for two new primitive types for signed and unsigned 8-bit integers (`Int8#` and `Word8` respectively) along with basic arithmetic and comparison operations. `PrimRep`/`RuntimeRep` get two new constructors for them. All of the primops translate into the existing `MachOP`s. - For `CmmCall`s the codegen will now zero-extend the values at call site (so that they can be moved to the right register) and then truncate them back their original width. - x86 native codegen needed some updates, since it wasn't able to deal with the new widths, but all the changes are quite localized. LLVM backend seems to just work. Bumps binary submodule. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate with new tests Reviewers: hvr, goldfire, bgamari, simonmar Subscribers: Abhiroop, dfeuer, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4475
* testsuite: disable nursery-chunks1 on non-smp targetsSergei Trofimovich2018-10-071-0/+1
| | | | | | | "ghc: setNumCapabilities: not supported on this platform" is caused by use of 'setNumCapabilities' in test itself. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* testsuite: disable T10017 on non-smp targetsSergei Trofimovich2018-10-071-0/+1
| | | | | | | T10017 needs multicore support from RTS: T10017: unknown RTS option: -N2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* testsuite: disable T14075 on non-smp targetsSergei Trofimovich2018-10-071-1/+3
| | | | | | | "ghc: setNumCapabilities: not supported on this platform" is caused by use of 'ghc --make -j2' in build rule. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Update performance numbers on WindowsTamar Christina2018-10-042-5/+10
| | | | | | | | | | | | Test Plan: ./validate Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5176
* Multiple fixes / improvements for LLVM backendKavon Farvardin2018-10-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix for #13904 -- stop "trashing" callee-saved registers, since it is not actually doing anything useful. - Fix for #14251 -- fixes the calling convention for functions passing raw SSE-register values by adding padding as needed to get the values in the right registers. This problem cropped up when some args were unused an dropped from the live list. - Fixed a typo in 'readnone' attribute - Added 'lower-expect' pass to level 0 LLVM optimization passes to improve block layout in LLVM for stack checks, etc. Test Plan: `make test WAYS=optllvm` and `make test WAYS=llvm` Reviewers: bgamari, simonmar, angerman Reviewed By: angerman Subscribers: rwbarton, carter GHC Trac Issues: #13904, #14251 Differential Revision: https://phabricator.haskell.org/D5190
* testsuite: Skip T3171 for nowBen Gamari2018-10-041-0/+1
| | | | | | | | | | | | | | | | This test is remarkably flaky, failing regularly on i386/Linux, amd64/Fedora, and amd64/Darwin. I've opened #15383 to track this and am disabling the test for now until we have a chance to investigate. Test Plan: Validate Reviewers: alpmestan Subscribers: rwbarton, carter GHC Trac Issues: #15383 Differential Revision: https://phabricator.haskell.org/D5202
* Set `infixr -1 ->`Alec Theriault2018-10-044-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This simply makes explicit what is already the case. Due to special treatment in the parser, `->` has the lowest fixity. This patch propagates that information to: * GHCi, where `:info ->` now return the right fixity * TH, where `reifyFixity` returns the right fixity * the generated sources for `GHC.Prim` See #15235. Test Plan: make test Reviewers: bgamari, alanz, RyanGlScott Reviewed By: RyanGlScott Subscribers: int-index, RyanGlScott, rwbarton, mpickering, carter GHC Trac Issues: #15235 Differential Revision: https://phabricator.haskell.org/D5199
* Don't drop arguments in TH type argumentsAlec Theriault2018-10-044-0/+54
| | | | | | | | | | | | | | | | | | | Summary: When converting from TH AST back to HsType, we were occasionally dropping type arguments. This resulted in incorrectly accepted programs as well as incorrectly rejected programs. Test Plan: make TEST=T15360a && make TEST=T15360b Reviewers: goldfire, bgamari, tdammers Reviewed By: bgamari, tdammers Subscribers: RyanGlScott, rwbarton, carter GHC Trac Issues: #15360 Differential Revision: https://phabricator.haskell.org/D5188
* Allow (unparenthesized) kind signaturesAlec Theriault2018-10-0413-27/+661
| | | | | | | | | | | | | | | | Summary: This allows for things like `[t :: MyKind]`, `(a :: k, b)`, and so on. Test Plan: make TEST=T11622 && make TEST=T8708 Reviewers: RyanGlScott, bgamari, simonpj, goldfire, alanz Reviewed By: RyanGlScott, simonpj Subscribers: alanz, simonpj, rwbarton, mpickering, carter GHC Trac Issues: #11622, #8708 Differential Revision: https://phabricator.haskell.org/D5173
* Improve generated `GHC.Prim` docsAlec Theriault2018-10-043-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: * Extended `genprimcode` to generate Haddock-compatible deprecations, as well as displaying information about which functions are LLVM-only and which functions can fail with an unchecked exception. * Ported existing deprecations to the new format, and also added a deprecation on `par#` (see Trac #15227). * Emit an error on fixity/deprecation of builtins, unless we are processing the module in which that name is defined (see Trac #15233). That means the following is no longer accepted (outside of `GHC.Types`): ``` infixr 7 : {-# DEPRECATED (:) "cons is deprecated" #-} ``` * Generate `data (->) a b` with docs and fixity in `GHC.Prim`. This means: GHC can now parse `data (->) a b` and `infixr 0 ->` (only in `GHC.Prim`) and `genprimcode` can digest `primtype (->) a b` (See Trac #4861) as well as some misc fixes along the way. Reviewers: bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, mpickering, carter GHC Trac Issues: #15227, #15233, #4861 Differential Revision: https://phabricator.haskell.org/D5167
* Distinguish Inferred from Specified tyvarsSimon Peyton Jones2018-10-043-0/+17
| | | | | | | | | | | | | In a declared type we need to distinguish between Inferred and Specified type variables. This was exposed by Trac #15592. See Note [Work out final tyConBinders] in TcTyClsDecls. I had to change the definition of HasField in GHC.Records to class HasField x r a | x r -> a where so as to have an /inferred/ kind argument rather than a specfied one. So HasField :: forall {k}. k -> * -> * -> Constraint
* Better pretty-printing of forall typesSimon Peyton Jones2018-10-041-2/+2
| | | | | | | | | | Currently forall-types with a lot of type variables, or type variables with big kinds, are pretty-printed too horizontally, and dribble off to the right in an illegible way. This patch treats the type variables as a group, and uses 'fsep' to lay them out decently.
* Fail fast on pattern synonymsSimon Peyton Jones2018-10-045-0/+47
| | | | | | | | | | | | | We were recovering too eagerly from errors in pattern-synonym type inference, leading to a cascade of confusing follow up errors (Trac #15685, #15692). The underlying issue is that a pattern synonym should have a closed, fixed type, with no unification variables in it. But it wasn't! Fixing this made me change the interface to simplifyInfer slightly. Instead of /emitting/ a residual implication constraint, it now /returns/ it, so that the caller can decide what to do.
* Do not mark CoVars as dead in the occur-analSimon Peyton Jones2018-10-043-0/+94
| | | | | | | | For years we have been marking CoVars as dead, becuase we don't gather occurrence info from types. This is obviously wrong and caused Trac #15695. See Note [Do not mark CoVars as dead] in OccurAnal.
* Better -ddump-typesSimon Peyton Jones2018-10-0418-74/+54
| | | | | | | | | | | The debug flag -ddump-types is supposed to show the type of Ids, and the kinds of type constructors. It was doing the former but not the latter -- instead it was using showTyTying, which is actually less helpful when debugging. This patch changes it to print the kind and roles of the thing. I also made -ddump-types show pattern synonyms
* Parse the (!) type operator and allow type operators in existential contextVladislav Zavialov2018-10-0422-35/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Improve the way `(!)`, `(~)`, and other type operators are handled in the parser, fixing two issues at once: 1. `(!)` can now be used as a type operator that respects fixity and precedence (#15457) 2. Existential context of a data constructor no longer needs parentheses (#15675) In addition to that, with this patch it is now trivial to adjust precedence of the `{-# UNPACK #-}` pragma, as suggested in https://ghc.haskell.org/trac/ghc/ticket/14761#comment:7 There was a small change to API Annotations. Before this patch, `(~)` was a strange special case that produced an annotation unlike any other type operator. After this patch, when `(~)` or `(!)` are used to specify strictness they produce AnnTilde and AnnBang annotations respectively, and when they are used as type operators, they produce no annotations. Test Plan: Validate Reviewers: simonpj, bgamari, alanz, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, mpickering, carter GHC Trac Issues: #15457, #15675 Differential Revision: https://phabricator.haskell.org/D5180
* GHCi should not filter instances involving cTuplesAlec Theriault2018-10-023-0/+15
| | | | | | | | | | | | | | | | Summary: See the new T12005 test case for an example of this. Test Plan: make TEST=T12005 Reviewers: bgamari, osa1 Reviewed By: osa1 Subscribers: osa1, rwbarton, carter GHC Trac Issues: #12005 Differential Revision: https://phabricator.haskell.org/D5182
* resolve T13704chessai2018-10-022-1/+4
| | | | | | | | | | | | | | | | | Summary: allow -main-is to change export list for default module header, allowing one to change the entry point to one's program. Test Plan: ./validate Reviewers: bgamari, nomeata, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, carter GHC Trac Issues: #13704 Differential Revision: https://phabricator.haskell.org/D5189
* Quantify class variables first in associated families' kindsRyan Scott2018-10-014-0/+17
| | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, `kcLHsQTyVars` would always quantify class-bound variables invisibly in the kinds of associated types, resulting in #15591. We counteract this by explicitly passing the class-bound variables to `kcLHsQTyVars` and quantifying over the ones that are mentioned in the associated type such that (1) they are specified, and (2) they come before other kind variables. See `Note [Kind variable ordering for associated types]`. Test Plan: make test TEST=T15591 Reviewers: goldfire, simonpj, bgamari Reviewed By: simonpj Subscribers: rwbarton, carter GHC Trac Issues: #15591 Differential Revision: https://phabricator.haskell.org/D5159
* Fix #15637 by using VTA more in GNDRyan Scott2018-10-015-14/+32
| | | | | | | | | | | | | | | | | | | | | | Summary: The code that GND was generating before could crumple over if it derived an instance for a class with an ambiguous type variable in the class head, such as the example in #15637. The solution is straightforward: simply instantiate all variables bound by the class head explicitly using visible type application, which will nip any ambiguity in the bud. Test Plan: make test TEST=T15637 Reviewers: bgamari, simonpj, goldfire Reviewed By: simonpj Subscribers: simonpj, rwbarton, carter GHC Trac Issues: #15637 Differential Revision: https://phabricator.haskell.org/D5148
* Add -fkeep-cafsSimon Marlow2018-09-288-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | Summary: I noticed while playing around with https://github.com/fbsamples/ghc-hotswap/ that the main binary needs to have a custom main function to set `config.keep_cafs = true` when initialising the runtime. This is pretty annoying, it means an extra C file with some cryptic incantations in it, and a `-no-hs-main` flag. So I've replaced this with a link-time flag to GHC, `-fkeep-cafs` that does the same thing. Test Plan: New unit test that tests for the RTS's GC'd CAFs assertion, and also the -keep-cafs flag. Reviewers: bgamari, osa1, erikd, noamz Reviewed By: osa1 Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5183
* Normalise EmptyCase types using the constraint solverRyan Scott2018-09-284-6/+31
| | | | | | | | | | | | | | | | | | | | | Summary: Certain `EmptyCase` expressions were mistakently producing warnings since their types did not have as many type families reduced as they could have. The most direct way to fix this is to normalise these types initially using the constraint solver to solve for any local equalities that may be in scope. Test Plan: make test TEST=T14813 Reviewers: simonpj, bgamari, goldfire Reviewed By: simonpj Subscribers: rwbarton, carter GHC Trac Issues: #14813 Differential Revision: https://phabricator.haskell.org/D5094
* Fix for recover with -fexternal-interpreter (#15418)Simon Marlow2018-09-275-0/+45
| | | | | | | | | | | | | | | | | | | | Summary: When using -fexternal-interpreter, recover was not treating a Q compuation that simply registered an error with addErrTc as failing. Test Plan: New unit tests: * T15418 is the repro from in the ticket * TH_recover_warns is a new test to ensure that we're keeping warnings when the body of recover succeeds. Reviewers: bgamari, RyanGlScott, angerman, goldfire, erikd Subscribers: rwbarton, carter GHC Trac Issues: #15418 Differential Revision: https://phabricator.haskell.org/D5185
* Fix constant-folding for Integer shiftsSimon Peyton Jones2018-09-262-0/+7
| | | | | | | | | | | | | | | In this patch commit 869f69fd4a78371c221e6d9abd69a71440a4679a Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Wed Dec 11 18:19:34 2013 +0000 Guarding against silly shifts we deal with silly shifts like (Sll 1 9223372036854775807). But I only dealt with primops that Int# and Word#. Alas, the same problem affects shifts of Integer, as Trac #15673 showed. Fortunately, the problem is easy to fix.