summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in DsExprwip/ds-expr-typoMatthew Pickering2019-01-181-1/+1
|
* Small refactorSimon Peyton Jones2019-01-171-8/+6
| | | | ...to use the same error message rather than duplicating it
* Remove export of checkValidFamPats, never usedSimon Peyton Jones2019-01-171-1/+1
|
* Comments about data constructor wrappersSimon Peyton Jones2019-01-171-30/+40
|
* 'DynFlag'-free version of 'mkParserFlags'Alec Theriault2019-01-173-330/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a fixed version of the reverted d2fbc33c4ff3074126ab71654af8bbf8a46e4e11 and 5aa29231ab7603537284eff5e4caff3a73dba6d2. Obtaining a `DynFlags` is difficult, making using the lexer/parser for pure parsing/lexing unreasonably difficult, even with `mkPStatePure`. This is despite the fact that we only really need * language extension flags * warning flags * a handful of boolean options The new `mkParserFlags'` function makes is easier to directly construct a `ParserFlags`. Furthermore, since `pExtsBitmap` is just a footgun, I've gone ahead and made `ParserFlags` an abstract type. Also, we now export `ExtBits` and `getBit` instead of defining/exporting a bunch of boilerplate functions that test for a particular 'ExtBits'. In the process, I also * cleaned up an unneeded special case for `ITstatic` * made `UsePosPrags` another variant of `ExtBits` * made the logic in `reservedSymsFM` match that of `reservedWordsFM` Test Plan: make test Reviewers: bgamari, alanz, tdammers Subscribers: sjakobi, tdammers, rwbarton, mpickering, carter GHC Trac Issues: #11301 Differential Revision: https://phabricator.haskell.org/D5405
* PPC NCG: Rename constructorsPeter Trommler2019-01-171-28/+29
| | | | | Rename constructors in calling convention data type to reflect the fact that they represent an ELF ABI not only a Linux ABI.
* Fix tab and improve whitespacePeter Trommler2019-01-171-7/+8
|
* PPC NCG: Register definitions for all 64-bit systemsPeter Trommler2019-01-171-7/+3
|
* PPC NCG: GOT declaration for all 64-bit ELF systemsPeter Trommler2019-01-171-5/+3
|
* PPC NCG: Make `stackHeaderSize` more generalPeter Trommler2019-01-171-7/+6
|
* PPC NCG: Make calling convention more generalPeter Trommler2019-01-171-6/+5
| | | | | All operating systems except AIX and Darwin follow the ELF specification.
* Support printing `integer-simple` Integers in GHCiAlec Theriault2019-01-162-1/+45
| | | | | | | | | | This means that `:p` no longer leaks the implementation details of `Integer` with `integer-simple`. The `print037` test case should exercise all possible code paths for GHCi's code around printing `Integer`s (both in `integer-simple` and `integer-gmp`). `ghc` the package now also has a Cabal `integer-simple` flag (like the `integer-gmp` one).
* Create folder if missing for .hie filesAlec Theriault2019-01-161-3/+5
| | | | | | | | | | | | | | | Summary: This matches the existing behaviour for .hi files: if the user requests the interface file be written in some location, we should create the parent folder if it doesn't already exist. Reviewers: bgamari, sjakobi Reviewed By: sjakobi Subscribers: sjakobi, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5463
* PPC NCG: Refactor stack allocation codePeter Trommler2019-01-162-26/+15
| | | | | There is only one place where UPDATE_SP was used. Instead of the UPDATE_SP pseudo instruction build the list of instructions directly.
* Change comments as requested by code review. #10857Roland Senn2019-01-161-1/+1
|
* GHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857Roland Senn2019-01-161-0/+17
|
* @simonpj's suggested refactorRyan Scott2019-01-151-36/+71
|
* Control validity-checking of type synonym applications more carefullyRyan Scott2019-01-151-56/+185
| | | | | | | | | | | | | | | | | | | | Trac #16059 shows that when validity checking applications of type synonyms, GHC sometimes wasn't checking the expanded type enough. We must be careful, however, since checking both the expanded type as well as the arguments to the type synonym can lead to exponential blowup (see https://ghc.haskell.org/trac/ghc/ticket/16059#comment:4). Nor can we omit checking either the expanded type or the argument for correctness reasons. The solution here is to introduce a new `ExpandMode` data type that is plumbed through all of the type-validity-checking functions in `TcValidity`. `ExpandMode` dictates whether we only check the expanded type (`Expand`), only check the arguments (`NoExpand), or both (`Both`). Importantly, if we check `Both` in the function for validity checking type synonym applications, then we switch to `NoExpand` when checking the arguments so as to avoid exponential blowup. See `Note [Correctness and performance of type synonym validity checking]` for the full story.
* Fix #16116 by removing badAssocRhsRyan Scott2019-01-151-15/+15
|
* Fix #16114 by adding a validity check to rnClsInstDeclRyan Scott2019-01-152-13/+20
|
* PPC NCG: Reduce memory consumption emitting string literalsPeter Trommler2019-01-134-66/+55
|
* Refactor GHCi UI to fix #11606, #12091, #15721, #16096Ömer Sinan Ağacan2019-01-135-41/+66
| | | | | | | | | | | | | Instead of parsing and executing a statement or declaration directly we now parse them first and then execute in a separate step. This gives us the flexibility to inspect the parsed declaration before execution. Using this we now inspect parsed declarations, and if it's a single declaration of form `x = y` we execute it as `let x = y` instead, fixing a ton of problems caused by poor declaration support in GHCi. To avoid any users of the modules I left `execStmt` and `runDecls` unchanged and added `execStmt'` and `runDecls'` which work on parsed statements/declarations.
* Don't invoke dataConSrcToImplBang on newtypesRyan Scott2019-01-121-7/+41
|
* More minor comment improvementsRichard Eisenberg2019-01-112-12/+8
| | | | [skip ci]
* Run typed splices in the zonkerMatthew Pickering2019-01-1110-44/+183
| | | | | | | | | | | | | | | | | Summary: This fixes #15471 In the typechecker we check that the splice has the right type but we crucially don't zonk the generated expression. This is because we might end up unifying type variables from outer scopes later on. Reviewers: simonpj, goldfire, bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15471 Differential Revision: https://phabricator.haskell.org/D5286
* Be pickier about unsaturated synonyms in :kindRyan Scott2019-01-084-11/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently permit any and all uses of unsaturated type synonyms and type families in GHCi's `:kind` command, which allows strange interactions like this one: ``` > :set -XTypeFamilies -XPolyKinds > type family Id (a :: k) > type instance Id a = a > type Foo x = Maybe > :kind! Id Foo ``` This is probably a stretch too far, so this patch moves to disallow unsaturated synonyms that aren't at the top level (we still want to allow `:kind Id`, for instance). We do this by augmenting `GhciCtxt` with an additional `Bool` field to indicate if we are at the outermost level of the type being passed to `:kind` or not. See `Note [Unsaturated type synonyms in GHCi]` in `TcValidity` for the full story. Test Plan: make test TEST=T16013 Reviewers: goldfire, bgamari Reviewed By: goldfire Subscribers: simonpj, goldfire, rwbarton, carter GHC Trac Issues: #16013 Differential Revision: https://phabricator.haskell.org/D5471
* Check that libs found by GCC aren't foldersAlec Theriault2019-01-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We use 'gcc -B<base-location> --print-file-name mylib.a' as a way of checking if 'gcc' can discover 'mylib.a' at the given location. However, this can break down if there is a folder caller 'mylib.a' that 'gcc' can discover. We can guard against this by explicitly checking that the path returned by 'gcc' is a file. This may seem like a far-fetched scenario, but since 3d17f1f10fc00540ac052f2fd03182906aa47e35, we look for libraries without any prefix or suffix (ie. 'extra-libraries: softfloat', we look for just 'softfloat' as well as 'softloat.a', 'softfloat.dll.a', etc.) which means that there might actusally be a folder of that name in one of the base locations. Reviewers: Phyx, bgamari, hvr, angerman Reviewed By: Phyx, angerman Subscribers: angerman, rwbarton, carter GHC Trac Issues: #16063 Differential Revision: https://phabricator.haskell.org/D5462
* Fix #16133 by checking for TypeApplications in rnExprRyan Scott2019-01-064-9/+16
|
* Remove OPTIONS_HADDOCK hide in favour for not-homeAdam Sandberg Eriksson2019-01-061-1/+1
| | | | GHC Trac Issues: #15447
* Add -Wmissing-deriving-strategieschessai2019-01-063-1/+28
| | | | | | | | | | | | | | | Warn users when -XDerivingStrategies is enabled but not used, at each potential use site. add -Wmissing-deriving-strategies Reviewers: bgamari, RyanGlScott Subscribers: andrewthad, rwbarton, carter GHC Trac Issues: #15798 Differential Revision: https://phabricator.haskell.org/D5451
* Dump Cmm with -ddump-cmm when building .cmm filesÖmer Sinan Ağacan2019-01-051-0/+1
| | | | Fixes #16131
* Fix some typos, etc., in comments.Richard Eisenberg2019-01-032-6/+9
| | | | [ci skip]
* Visible kind applicationmynguyen2019-01-0323-526/+889
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362. It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind application, just like in term-level. There are a few remaining issues with this patch, as documented in ticket #16082. Includes a submodule update for Haddock. Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816` Differential Revision: https://phabricator.haskell.org/D5229
* PPC NCG: Remove Darwin supportPeter Trommler2019-01-019-241/+47
| | | | | | | Support for Mac OS X on PowerPC has been dropped by Apple years ago. We follow suit and remove PowerPC support for Darwin. Fixes #16106.
* PPC NCG: Simple 64-bit condition code on 32-bitPeter Trommler2018-12-301-3/+48
|
* rebindable-clash-warning-fix : correct warning logicShayne Fletcher2018-12-281-1/+1
|
* Simplify Core output with -dsuppress-type-signaturesÖmer Sinan Ağacan2018-12-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Currently we duplicate top-level binder ids for no reason: $fEqHsExpr_$c/= $fEqHsExpr_$c/= = \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 -> case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of { False -> True; True -> False } with this patch we drop the first line when type signatures are not printed (-dsuppress-type-signatures, which is implied by -dsuppress-all) Reviewers: simonpj, bgamari Reviewed By: simonpj Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5472
* LoadIface: Fix another CPP/Clang issueBen Gamari2018-12-221-1/+1
|
* TcRnDriver: Fix haddock-like commentBen Gamari2018-12-211-6/+6
|
* remove optionGabor Greif2018-12-211-1/+0
|
* Fix treatment of hi-boot files and dfunsSimon Peyton Jones2018-12-214-194/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trac #16038 exposed the fact that TcRnDriver.checkHiBootIface was creating a binding, in the module being compiled, for $fxBlah = $fBlah but $fxBlah was a /GlobalId/. But all bindings should be for /LocalIds/ else dependency analysis goes down the tubes. * I added a CoreLint check that an occurrence of a GlobalId is not bound by an binding of a LocalId. (There is already a binding-site check that no binding binds a GlobalId.) * I refactored (and actually signficantly simplified) the tricky code for dfuns in checkHiBootIface to ensure that we get LocalIds for those boot-dfuns. Alas, I then got "duplicate instance" messages when compiling HsExpr. It turns out that this is a long-standing, but extremely delicate, bug: even before this patch, if you compile HsExpr with -ddump-tc-trace, you get "duplicate instance". Without -ddump-tc-trace, it's OK. What a mess! The reason for the duplicate-instance is now explained in Note [Loading your own hi-boot file] in LoadIface. I fixed it by a Gross Hack in LoadIface.loadInterface. This is at least no worse than before. But there should be a better way. I have opened #16081 for this.
* Tiny refactor to tcExtendRecEnvSimon Peyton Jones2018-12-211-2/+7
| | | | | | | | | In tcExtendRecEnv, there is no need to us setGlobalTypeEnv (which side-effects the tcg_type_env_var). tcExtendRecEnv is used only when kind-checking a group of type/class decls and no knot-tying via tcg_type_env_var is needed. There is no change in functionality.
* Comments onlySimon Peyton Jones2018-12-212-11/+17
|
* Make candidateQTvs contain tyvar with zonked kindsSimon Peyton Jones2018-12-211-68/+82
| | | | | | | | | | | candidateQTyVars was failing to return fully-zonked tyvars, and that made things fall over chaotically when we try to sort them into a well-scoped telescope. Result: Trac #15795 So I made candidateQTvs guarantee to have fully-zonked tyvars (i.e. with zonked kinds). That's a bit annoying but not really difficult.
* Fix #16002 by moving a validity check to the renamerRyan Scott2018-12-202-23/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The validity check which rejected things like: ```lang=haskell type family B x where A x = x ``` Used to live in the typechecker. But it turns out that this validity check was //only// being run on closed type families without CUSKs! This meant that GHC would silently accept something like this: ```lang=haskell type family B (x :: *) :: * where A x = x ``` This patch fixes the issue by moving this validity check to the renamer, where we can be sure that the check will //always// be run. Test Plan: make test TEST=T16002 Reviewers: simonpj, bgamari Reviewed By: simonpj Subscribers: goldfire, rwbarton, carter GHC Trac Issues: #16002 Differential Revision: https://phabricator.haskell.org/D5420
* Refine the suppression of RuntimeRep variablesSimon Peyton Jones2018-12-201-56/+77
| | | | | | | | When we pretty-print types, we suppress RuntimeRep variables, but we were being too aggressive in doing so, resulting in Trac #16074. This patch makes the suppression a bit less aggressive. See Note [Defaulting RuntimeRep variables]
* Add solveLocalEqualities to tcHsPatSigTypeSimon Peyton Jones2018-12-201-1/+5
| | | | | | | This call plain missing, and as a result the casts messed up deep-skolemisation in tcSubType Fixes Trac #16033
* Remove an old OPTIONS_GHCÖmer Sinan Ağacan2018-12-201-4/+0
|
* Fix #16030 by refactoring IfaceSyn's treatment of GADT constructorsRyan Scott2018-12-192-31/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: GHCi's `:info` command was pretty-printined GADT constructors suboptimally in the following ways: 1. Sometimes, fields were parenthesized when they did not need it, e.g., ```lang=haskell data Foo a where MkFoo :: (Maybe a) -> Foo a ``` I fixed this by refactoring some code in `pprIfaceConDecl` to be a little smarter with respect to GADT syntax. See `pprFieldArgTy` and `pprArgTy`. 2. With `-fprint-explicit-kinds` enabled, there would be times when specified arguments would be printed without a leading `@` in GADT return types, e.g., ```lang=haskell data Bar @k (a :: k) where MkBar :: Bar k a ``` It turns out that `ppr_tc_app`, the function which pretty-prints these return types, was not using the proper machinery to print out the arguments, which caused the visibilities to be forgotten entirely. I refactored `ppr_tc_app` to do this correctly. Test Plan: make test TEST=T16030 Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, carter GHC Trac Issues: #16030 Differential Revision: https://phabricator.haskell.org/D5440
* Use unicode arrows with -fprint-unicode-syntaxKrzysztof Gogolewski2018-12-191-1/+1
| | | | | | | | | | | | | | | | | | Summary: See #8959, this is one more place where we can pretty-print Unicode syntax. Test Plan: validate Reviewers: nomeata, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #8959 Differential Revision: https://phabricator.haskell.org/D5439