summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* testsuite: Only run llvm ways if llc is availablewip/T18560Ben Gamari2020-08-164-19/+14
| | | | | | | | | As noted in #18560, we previously would always run the LLVM ways since `configure` would set `SettingsLlcCommand` to something non-null when it otherwise couldn't find the `llc` executable. Now we rather probe for the existence of the `llc` executable in the testsuite driver. Fixes #18560.
* 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.
* DynFlags: don't use sdocWithDynFlags in datacon pprSylvain Henry2020-07-306-24/+25
| | | | | | | We don't need to use `sdocWithDynFlags` to know whether we should display linear types for datacon types, we already have `sdocLinearTypes` field in `SDocContext`. Moreover we want to remove `sdocWithDynFlags` (#10143, #17957)).
* Fix minimal imports dump for boot files (fix #18497)Sylvain Henry2020-07-309-10/+60
|
* Add two bangs to improve perf of flatteningSimon Peyton Jones2020-07-301-4/+6
| | | | | | | | | | | | | | | | | | | | This tiny patch improves the compile time of flatten-heavy programs by 1-2%, by adding two bangs. Addresses (somewhat) #18502 This reduces allocation by T9872b -1.1% T9872d -3.3% T5321Fun -0.2% T5631 -0.2% T5837 +0.1% T6048 +0.1% Metric Decrease: T9872b T9872d
* Remove an incorrect WARN in extendLocalRdrEnvSimon Peyton Jones2020-07-302-20/+41
| | | | | | I noticed this warning going off, and discovered that it's really fine. This small patch removes the warning, and docments what is going on.
* Don't mark closed type family equations as occurrencesRyan Scott2020-07-3011-71/+147
| | | | | | | | | | | | | | | | | | | | | | | | Previously, `rnFamInstEqn` would mark the name of the type/data family used in an equation as an occurrence, regardless of what sort of family it is. Most of the time, this is the correct thing to do. The exception is closed type families, whose equations constitute its definition and therefore should not be marked as occurrences. Overzealously counting the equations of a closed type family as occurrences can cause certain warnings to not be emitted, as observed in #18470. See `Note [Type family equations and occurrences]` in `GHC.Rename.Module` for the full story. This fixes #18470 with a little bit of extra-casing in `rnFamInstEqn`. To accomplish this, I added an extra `ClosedTyFamInfo` field to the `NonAssocTyFamEqn` constructor of `AssocTyFamInfo` and refactored the relevant call sites accordingly so that this information is propagated to `rnFamInstEqn`. While I was in town, I moved `wrongTyFamName`, which checks that the name of a closed type family matches the name in an equation for that family, from the renamer to the typechecker to avoid the need for an `ASSERT`. As an added bonus, this lets us simplify the details of `ClosedTyFamInfo` a bit.
* Clean up the inferred type variable restrictionRyan Scott2020-07-3014-128/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch primarily: * Documents `checkInferredVars` (previously called `check_inferred_vars`) more carefully. This is the function which throws an error message if a user quantifies an inferred type variable in a place where specificity cannot be observed. See `Note [Unobservably inferred type variables]` in `GHC.Rename.HsType`. Note that I now invoke `checkInferredVars` _alongside_ `rnHsSigType`, `rnHsWcSigType`, etc. rather than doing so _inside_ of these functions. This results in slightly more call sites for `checkInferredVars`, but it makes it much easier to enumerate the spots where the inferred type variable restriction comes into effect. * Removes the inferred type variable restriction for default method type signatures, per the discussion in #18432. As a result, this patch fixes #18432. Along the way, I performed some various cleanup: * I moved `no_nested_foralls_contexts_err` into `GHC.Rename.Utils` (under the new name `noNestedForallsContextsErr`), since it now needs to be invoked from multiple modules. I also added a helper function `addNoNestedForallsContextsErr` that throws the error message after producing it, as this is a common idiom. * In order to ensure that users cannot sneak inferred type variables into `SPECIALISE instance` pragmas by way of nested `forall`s, I now invoke `addNoNestedForallsContextsErr` when renaming `SPECIALISE instance` pragmas, much like when we rename normal instance declarations. (This probably should have originally been done as a part of the fix for #18240, but this task was somehow overlooked.) As a result, this patch fixes #18455 as a side effect.
* Add haddock comment for unfilteredEdgescgibbard2020-07-301-9/+8
| | | and move the note about drop_hs_boot_nodes into it.
* For `-fkeep-going` do not duplicate dependency edge codeJohn Ericson2020-07-301-45/+47
| | | | | | | | We now compute the deps for `-fkeep-going` the same way that the original graph calculates them, so the edges are correct. Upsweep really ought to take the graph rather than a topological sort so we are never recalculating anything, but at least things are recaluclated consistently now.
* Fix validation errors (#18510)Krzysztof Gogolewski2020-07-295-10/+12
| | | | | | | Test T2632 is a stage1 test that failed because of the Q => Quote change. The remaining tests did not use quotation and failed when the path contained a space.
* Fix bug in Natural multiplication (fix #18509)Sylvain Henry2020-07-296-8/+19
| | | | | | A bug was lingering in Natural multiplication (inverting two limbs) despite QuickCheck tests used during the development leading to wrong results (independently of the selected backend).
* configure: Fix build system on ARMPeter Trommler2020-07-291-1/+1
|
* Kill off sc_mult and as_mult fieldsSimon Peyton Jones2020-07-292-67/+42
| | | | | | | They are readily derivable from other fields, so this is more efficient, and less error prone. Fixes #18494
* Filter out unreachable constructors when deriving stock instances (#16431)Brandon Chinn2020-07-293-18/+103
|
* Pass tc_args to gen_fnBrandon Chinn2020-07-293-32/+33
|
* Pass dit_rep_tc_args to dsm_stock_gen_fnBrandon Chinn2020-07-292-9/+15
|
* Add regression test for #16341Brandon Chinn2020-07-292-0/+32
|
* Fix typoFelix Wiemuth2020-07-291-1/+1
|
* ghc/mk: don't build gmp packages for BIGNUM_BACKEND=nativeSergei Trofimovich2020-07-281-0/+2
| | | | | | | | | | | | | | | Before this change make-based `BIGNUM_BACKEND=native` build was failing as: ``` x86_64-pc-linux-gnu-gcc: error: libraries/ghc-bignum/gmp/objs/*.o: No such file or directory ``` This happens because ghc.mk was pulling in gmp-dependent ghc-bignum library unconditionally. The change avoid building ghc-bignum. Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>