summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* testsuite: Add test for #18291wip/T18291Ben Gamari2020-08-132-0/+8
|
* Allow unsaturated runRW# applicationsBen Gamari2020-08-134-69/+111
| | | | | | | | | | | | | | | | | | Previously we had a very aggressive Core Lint check which caught unsaturated applications of runRW#. However, there is nothing wrong with such applications and they may naturally arise in desugared Core. For instance, the desugared Core of Data.Primitive.Array.runArray# from the `primitive` package contains: case ($) (runRW# @_ @_) (\s -> ...) of ... In this case it's almost certain that ($) will be inlined, turning the application into a saturated application. However, even if this weren't the case there isn't a problem: CorePrep (after deleting an unnecessary case) can simply generate code in its usual way, resulting in a call to the Haskell definition of runRW#. Fixes #18291.
* Re-add BangPatterns to CodePage.hsHécate2020-08-131-0/+2
|
* PmCheck: Better long-distance info for where bindings (#18533)Sebastian Graf2020-08-1315-146/+211
| | | | | | | | | | | | | | | | | | | | Where bindings can see evidence from the pattern match of the `GRHSs` they belong to, but not from anything in any of the guards (which belong to one of possibly many RHSs). Before this patch, we did *not* consider said evidence, causing #18533, where the lack of considering type information from a case pattern match leads to failure to resolve the vanilla COMPLETE set of a data type. Making available that information required a medium amount of refactoring so that `checkMatches` can return a `[(Deltas, NonEmpty Deltas)]`; one `(Deltas, NonEmpty Deltas)` for each `GRHSs` of the match group. The first component of the pair is the covered set of the pattern, the second component is one covered set per RHS. Fixes #18533. Regression test case: T18533
* parser: Suggest ImportQualifiedPost in prepositive import warningBen Gamari2020-08-132-0/+2
| | | | As suggested in #18545.
* ApiAnnotations: Fix parser for new GHC 9.0 featuresAlan Zimmerman2020-08-121-4/+5
|
* Rewrite and move the monad-state hack noteSylvain Henry2020-08-124-75/+176
| | | | | | The note has been rewritten by @simonpj in !3851 [skip ci]
* testsuite: Increase tolerance of T16916Ben Gamari2020-08-121-1/+1
| | | | | | | | T16916 (testing #16916) has been slightly fragile in CI due to its reliance on CPU times. While it's hard to see how to eliminate the time-dependence entirely, we can nevertheless make it more tolerant. Fixes #16966.
* DynFlags: disentangle OutputableSylvain Henry2020-08-12323-331/+743
| | | | | | | | | - put panic related functions into GHC.Utils.Panic - put trace related functions using DynFlags in GHC.Driver.Ppr One step closer making Outputable fully independent of DynFlags. Bump haddock submodule
* testsuite: Specify metrics collected by T17516Ben Gamari2020-08-111-1/+1
| | | | | | | Previously it collected everything, including "max bytes used". This is problematic since the test makes no attempt to control for deviations in GC timing, resulting in high variability. Fix this by only collecting "bytes allocated".
* Add hie.yaml to ghc-heapSven Tennie2020-08-111-0/+12
| | | | This enables IDE support by haskell-language-server for ghc-heap.
* testsuite: Add test for #18118Ben Gamari2020-08-113-0/+11
|
* typecheck: Drop SPECIALISE pragmas when there is no unfoldingBen Gamari2020-08-111-3/+7
| | | | | | | | Previously the desugarer would instead fall over when it realized that there was no unfolding for an imported function with a SPECIALISE pragma. We now rather drop the SPECIALISE pragma and throw a warning. Fixes #18118.
* Make splitAtList strict in its argumentsSylvain Henry2020-08-101-5/+9
| | | | | | | | | Also fix its slightly wrong comment Metric Decrease: T5030 T12227 T12545
* Add a closing parenthesis tooFelix Yan2020-08-101-1/+1
|
* Correct a typo in ghc.mkFelix Yan2020-08-101-1/+1
|
* Avoid allocations in `splitAtList` (#18535)Sylvain Henry2020-08-091-5/+8
| | | | | | | | | | | | | | | | | | | | | | As suspected by @simonpj in #18535, avoiding allocations in `GHC.Utils.Misc.splitAtList` when there are no leftover arguments is beneficial for performance: On CI validate-x86_64-linux-deb9-hadrian: T12227 -7% T12545 -12.3% T5030 -10% T9872a -2% T9872b -2.1% T9872c -2.5% Metric Decrease: T12227 T12545 T5030 T9872a T9872b T9872c
* Api Annotations : Adjust SrcSpans for prefix bang (!).Alan Zimmerman2020-08-093-4/+6
| | | | | | And prefix ~ (cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)
* hadrian: depend on boot compiler version #18001Adam Sandberg Ericsson2020-08-091-1/+6
|
* configure: Fix double-negation in ld merge-objects checkBen Gamari2020-08-071-1/+1
| | | | | We want to only run the check if ld is gold. Fixes the fix to #17962.
* ApiAnnotations; tweaks for ghc-exactprint updateAlan Zimmerman2020-08-074-16/+16
| | | | | | Remove unused ApiAnns, add one for linear arrow. Include API Annotations for trailing comma in export list.
* testsuite: Fix prog001Ben Gamari2020-08-071-1/+1
| | | | Previously it failed as the `ghc` package was not visible.
* testsuite: Add test for #18527Ben Gamari2020-08-074-0/+38
|
* nativeGen: One approach to fix #18527Ben Gamari2020-08-072-8/+95
| | | | | | | Previously the code generator could produce corrupt C call sequences due to register overlap between MachOp lowerings and the platform's calling convention. We fix this using a hack described in Note [Evaluate C-call arguments before placing in destination registers].
* CmmLint: Check foreign call argument register invariantBen Gamari2020-08-071-5/+35
| | | | | As mentioned in Note [Register parameter passing] the arguments of foreign calls cannot refer to caller-saved registers.
* cmm: Clean up Notes a bitBen Gamari2020-08-075-8/+12
|
* Add some tests for fail messages in do-expressions and monad-comprehensions.Cale Gibbard2020-08-078-5/+15
|
* A fix to an error message in monad comprehensions, and a move of ↵Cale Gibbard2020-08-074-36/+33
| | | | | | dsHandleMonadicFailure as suggested by comments on !2330.
* users-guide: Rename 8.12 to 9.0Takenobu Tani2020-08-068-9/+9
| | | | | | | | | GHC 8.12.1 has been renamed to GHC 9.0.1. See also: https://mail.haskell.org/pipermail/ghc-devs/2020-July/019083.html [skip ci]
* Use a type alias for WaysSylvain Henry2020-08-064-12/+13
|
* Fail eagerly on a lev-poly datacon argRichard Eisenberg2020-08-064-11/+39
| | | | | | Close #18534. See commentary in the patch.
* Fix visible forall in ppr_ty (#18522)Vladislav Zavialov2020-08-064-2/+30
| | | | | | | Before this patch, this type: T :: forall k -> (k ~ k) => forall j -> k -> j -> Type was printed incorrectly as: T :: forall k j -> (k ~ k) => k -> j -> Type
* Fix debug_ppr_ty ForAllTy (#18522)Vladislav Zavialov2020-08-064-12/+84
| | | | | | | Before this change, GHC would pretty-print forall k. forall a -> () as forall @k a. () which isn't even valid Haskell.
* Clean up the story around runPV/runECP_P/runECP_PVVladislav Zavialov2020-08-062-129/+124
| | | | | | | | | | | | | This patch started as a small documentation change, an attempt to make Note [Parser-Validator] and Note [Ambiguous syntactic categories] more clear and up-to-date. But it turned out that runECP_P/runECP_PV are weakly motivated, and it's easier to remove them than to find a good rationale/explanation for their existence. As the result, there's a bit of refactoring in addition to a documentation update.
* Grammar for types and data/newtype constructorsVladislav Zavialov2020-08-068-365/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, we parsed types into a reversed sequence of operators and operands. For example, (F x y + G a b * X) would be parsed as [X, *, b, a, G, +, y, x, F], using a simple grammar: tyapps : tyapp | tyapps tyapp tyapp : atype | PREFIX_AT atype | tyop | unpackedness Then we used a hand-written state machine to assemble this either into a type, using 'mergeOps', or into a constructor, using 'mergeDataCon'. This is due to a syntactic ambiguity: data T1 a = MkT1 a data T2 a = Ord a => MkT2 a In T1, what follows after the = sign is a data/newtype constructor declaration. However, in T2, what follows is a type (of kind Constraint). We don't know which of the two we are parsing until we encounter =>, and we cannot check for => without unlimited lookahead. This poses a few issues when it comes to e.g. infix operators: data I1 = Int :+ Bool :+ Char -- bad data I2 = Int :+ Bool :+ Char => MkI2 -- fine By this issue alone we are forced into parsing into an intermediate representation and doing a separate validation pass. However, should that intermediate representation be as low-level as a flat sequence of operators and operands? Before GHC Proposal #229, the answer was Yes, due to some particularly nasty corner cases: data T = ! A :+ ! B -- used to be fine, hard to parse data T = ! A :+ ! B => MkT -- bad However, now the answer is No, as this corner case is gone: data T = ! A :+ ! B -- bad data T = ! A :+ ! B => MkT -- bad This means we can write a proper grammar for types, overloading it in the DisambECP style, see Note [Ambiguous syntactic categories]. With this patch, we introduce a new class, DisambTD. Just like DisambECP is used to disambiguate between expressions, commands, and patterns, DisambTD is used to disambiguate between types and data/newtype constructors. This way, we get a proper, declarative grammar for constructors and types: infixtype : ftype | ftype tyop infixtype | unpackedness infixtype ftype : atype | tyop | ftype tyarg | ftype PREFIX_AT tyarg tyarg : atype | unpackedness atype And having a grammar for types means we are a step closer to using a single grammar for types and expressions.
* Make CodeQ and TExpQ levity polymorphicRyan Scott2020-08-055-3/+36
| | | | | | | | | | | | The patch is quite straightforward. The only tricky part is that `Language.Haskell.TH.Lib.Internal` now must be `Trustworthy` instead of `Safe` due to the `GHC.Exts` import (in order to import `TYPE`). Since `CodeQ` has yet to appear in any released version of `template-haskell`, I didn't bother mentioning the change to `CodeQ` in the `template-haskell` release notes. Fixes #18521.
* Remove all the unnecessary LANGUAGE pragmasHécate2020-08-0560-188/+160
|
* Refactor handling of object mergingBen Gamari2020-08-0521-54/+252
| | | | | | | | | Previously to merge a set of object files we would invoke the linker as usual, adding -r to the command-line. However, this can result in non-sensical command-lines which causes lld to balk (#17962). To avoid this we introduce a new tool setting into GHC, -pgmlm, which is the linker which we use to merge object files.
* Revert "iserv: Don't pass --export-dynamic on FreeBSD"Ben Gamari2020-08-051-2/+1
| | | | This reverts commit 2290eb02cf95e9cfffcb15fc9c593d5ef79c75d9.
* Rename Core.Opt.Driver -> Core.Opt.PipelineKrzysztof Gogolewski2020-08-054-4/+4
| | | | Closes #18504.
* Bignum: add more BigNat compat functions in integer-gmpSylvain Henry2020-08-052-0/+209
|
* Bignum: add backward compat integer-gmp functionsSylvain Henry2020-08-054-5/+41
| | | | Also enhance bigNatCheck# and isValidNatural test
* Hardcode RTS includes to cope with unregistered buildsAlex Biehl2020-08-031-18/+1
|
* hadrian: Fix running stage0/bin/ghc with wrong package DB. Fixes #17468.Niklas Hambüchen2020-08-032-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the invocation of `cabal configure`, `--ghc-pkg-option=--global-package-db` was already given correctly to tell `stage0/bin/ghc-pkg` that it should use the package DB in `stage1/`. However, `ghc` needs to be given this information as well, not only `ghc-pkg`! Until now that was not the case; the package DB in `stage0` was given to `ghc` instead. This was wrong, because there is no binary compatibility guarantee that says that the `stage0` DB's `package.cache` (which is written by the stage0 == system-provided ghc-pkg) can be deserialised by the `ghc-pkg` from the source code tree. As a result, when trying to add fields to `InstalledPackageInfo` that get serialised into / deserialised from the `package.cache`, errors like _build/stage0/lib/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!) would appear. This was because the `stage0/bin/ghc would try to deserialise the newly added fields from `_build/stage0/lib/package.conf.d/package.cache`, but they were not in there because the system `ghc-pkg` doesn't know about them and thus didn't write them there. It would try to do that because any GHC by default tries to read the global package db in `../lib/package.conf.d/package.cache`. For `stage0/bin/ghc` that *can never work* as explained above, so we must disable this default via `-no-global-package-db` and give it the correct package DB explicitly. This is the same problem as #16534, and the same fix as in MR !780 (but in another context; that one was for developers trying out the `stage0/bin/ghc` == `_build/ghc-stage1` interactively, while this fix is for a `cabal configure` invocation). I also noticed that the fix for #16534 forgot to pass `-no-global-package-db`, and have fixed that in this commit as well. It only worked until now because nobody tried to add a new ghc-pkg `.conf` field since the introduction of Hadrian.
* Fix GHC_STAGE definition generated by makeLeon Schoorl2020-08-021-1/+1
| | | | | | | | | | Fixes #18070 GHC_STAGE is the stage of the compiler we're building, it should be 1,2(,3?). But make was generating 0 and 1. Hadrian does this correctly using a similar `+ 1`: https://gitlab.haskell.org/ghc/ghc/-/blob/eb8115a8c4cbc842b66798480fefc7ab64d31931/hadrian/src/Rules/Generate.hs#L245
* Remove ConDeclGADTPrefixPsRyan Scott2020-08-0212-403/+344
| | | | | | | | | | | | | | | | This removes the `ConDeclGADTPrefixPs` per the discussion in #18517. Most of this patch simply removes code, although the code in the `rnConDecl` case for `ConDeclGADTPrefixPs` had to be moved around a bit: * The nested `forall`s check now lives in the `rnConDecl` case for `ConDeclGADT`. * The `LinearTypes`-specific code that used to live in the `rnConDecl` case for `ConDeclGADTPrefixPs` now lives in `GHC.Parser.PostProcess.mkGadtDecl`, which is now monadic so that it can check if `-XLinearTypes` is enabled. Fixes #18157.
* Test case for #17652Vladislav Zavialov2020-08-013-0/+15
| | | | The issue was fixed by 19e80b9af252eee760dc047765a9930ef00067ec
* DynFlags: don't use sdocWithDynFlags in GHC.CmmToAsm.Dwarf.TypesSylvain Henry2020-07-311-7/+13
|
* Refactor CLabel pretty-printingSylvain Henry2020-07-3116-230/+250
| | | | | | | | Pretty-printing CLabel relies on sdocWithDynFlags that we want to remove (#10143, #17957). It uses it to query the backend and the platform. This patch exposes Clabel ppr functions specialised for each backend so that backend code can directly use them.
* Bignum: fix powMod for gmp backend (#18515)Sylvain Henry2020-07-307-13/+20
| | | | | Also reenable integerPowMod test which had never been reenabled by mistake.