summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Address #11471 by putting RuntimeRep in kinds.wip/runtime-repRichard Eisenberg2016-02-2454-995/+1521
| | | | | | | | | | | | | | | | | | | | | See Note [TYPE] in TysPrim. There are still some outstanding pieces in #11471 though, so this doesn't actually nail the bug. This commit also contains a few performance improvements: * Short-cut equality checking of nullary type syns * Compare types before kinds in eqType * INLINE coreViewOneStarKind * Store tycon binders separately from kinds. This resulted in a ~10% performance improvement in compiling the Cabal package. No change in functionality other than performance. (This affects the interface file format, though.) This commit updates the haddock submodule.
* Follow-up to 32a9a7f514bdd33ff72a673adeHerbert Valerio Riedel2016-02-231-2/+2
| | | | ...forgot to stage/add this alpha renaming to the previous commit
* Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*`Herbert Valerio Riedel2016-02-231-5/+7
| | | | | | | | | | | The original implementation for #11429 covers only `-W*` flags. However, old packages will continue to use `-f(no-)warn-*` flags, so it seems desirable to have `-Wunrecognised-warning-flag` apply to those legacy aliases as well. Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1942
* Allow combining characters in identifiers (#7650)Thomas Miedema2016-02-232-8/+9
| | | | | | Reviewed by: austin, rwbarton Differential Revision: https://phabricator.haskell.org/D1938
* Fix a bug in ApplicativeDo (#11612)Simon Marlow2016-02-201-6/+21
| | | | | In some cases ApplicativeDo would miss some opportunities, due to a wrong calculation of free variables in RnExpr.segments.
* Refactoring only: use ExprLStmtSimon Marlow2016-02-201-19/+19
|
* Modifier letter in middle of identifier is okThomas Miedema2016-02-192-16/+7
| | | | | | | | | | | | Refactoring only. Cleanup some loose ends from #10196. Initially the idea was to only allow modifier letters at the end of identifiers. Since we later decided to allow modifier letters also in the middle of identifiers (because not doing so would not fix the regression completely), the names `suffix` and `okIdSuffixChar` don't seem appropriate anymore. Remove TODO. Move test from should_fail to should_compile.
* Delete support for deprecated "-- # ..."-style haddock optionsThomas Miedema2016-02-193-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | A long time ago, you could use `"-- # <haddock options>"` to mean that `<haddock options.` should be passed to `haddock`. Since 2007 (03d8585e0940e28e024548654fe3505685aca94f), using `OPTIONS_HADDOCK` is the preferred way to do this. Why is ok to remove support for "-- # .."? * It is not mentioned in the Haddock user's guide, nor are there any tests that use it. * Ever since 2011 (b3e30449aa6d6eaa978eb3c7447ca85985d9d251), it doesn't actually work anymore. The function `getOptionsFromFile` uses `gopt_unset dflags Opt_Haddock` for other reasons, so even when running ghc with `--haddock`, the following rule always fires when the lexer sees "-- # ..", and it gets treated as a normal comment: ``` -- Next, match Haddock comments if no -haddock flag "-- " [$docsym \#] .* / { ifExtension (not . haddockEnabled) } { lineCommentToken } ``` Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1932
* A few more typos in non-codeGabor Greif2016-02-191-1/+1
|
* Unwire Typeable representation typesBen Gamari2016-02-185-147/+156
| | | | | | | | | | | | | | | | In order to make this work I needed to shuffle around typechecking a bit such that `TyCon` and friends are available during compilation of GHC.Types. I also did a bit of refactoring of `TcTypeable`. Test Plan: Validate Reviewers: simonpj, austin Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1906 GHC Trac Issues: #11120
* Take type-function arity into accountSimon Peyton Jones2016-02-181-2/+12
| | | | | | | | | | ...when computing the size of a call on the RHS of a type instance declaration. This came up in Trac #11581. The change is in TcType.tcTyFamInsts which now trims the type arguments in a call. See the comments with that function definition.
* Improve piResultTys and friendsSimon Peyton Jones2016-02-189-92/+110
| | | | | | | | | | | | | | | | | Several things here: * Re-implement piResultTys so that its substitution has the correct in-scope set That means paying close attention to performance, since as we discovered in Trac #11371, it's a heavily used function and is often used on ordinary function types, with no foralls to worry about substituting. * Kill off applyTys, which was just the same as piResultTys. * Re-engineer MkCore.mkCoreApps so that it calls piResultTys, rather than repeatedly calling piResultTy.
* (Another) minor refactoring of substitutionsSimon Peyton Jones2016-02-1822-161/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | No change in functionality here, but greater clarity: * In FamInstEnv.FlattenEnv, kill off the fi_in_scope field We are already maintaining an in-scope set in the fe_subst field, so it's silly do to it twice. (This isn't strictly connected to the rest of this patch, but the nomenclature changes below affect the same code, so I put them together.) * TyCoRep.extendTCVSubst used to take a TyVar or a CoVar and work out what to do, but in fact we almost always know which of the two we are doing. So: - define extendTvSubst, extendCvSubst - and use them * Similar renamings in TyCoRep: - extendTCvSubstList --> extendTvSubstList - extendTCvSubstBinder --> extendTvSubstBinder - extendTCvSubstAndInScope --> extendTvSubstAndInScope * Add Type.extendTvSubstWithClone, extendCvSubstWithClone * Similar nomenclature changes in Subst, SimplEnv, Specialise * Kill off TyCoRep.substTelescope (never used)
* Fix desugaring of bang-pattern let-bindingsSimon Peyton Jones2016-02-181-26/+23
| | | | | | | | | | | | | When implementing Strict Haskell, the patch 46a03fbe didn't faithfully implement the semantics given in the manual. In particular there was an ad-hoc case in mkSelectorBinds for "strict and no binders" that didn't work. This patch fixes it, curing Trac #11572. Howver it forced me to think about banged let-bindings, and I rather think we do not have quite the right semantics yet, so I've opened Trac #11601.
* Fix thinko that crept into D1908Ben Gamari2016-02-181-1/+1
| | | | RyanGlScott updated the Diff only after I had merged it.
* Comments only (#11513)Richard Eisenberg2016-02-171-0/+2
|
* Remove superfluous code when deriving Foldable/TraversableRyanGlScott2016-02-172-82/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, `-XDeriveFoldable` and `-XDeriveTraversable` generate unnecessary `mempty` and `pure` expressions when it traverses of an argument of a constructor whose type does not mention the last type parameter. Not only is this inefficient, but it prevents `Traversable` from being derivable for datatypes with unlifted arguments (see Trac #11174). The solution to this problem is to adopt a slight change to the algorithms for `-XDeriveFoldable` and `-XDeriveTraversable`, which is described in [this wiki page](https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/DeriveFu nctor#Proposal:alternativestrategyforderivingFoldableandTraversable). The wiki page also describes why we don't apply the same changes to the algorithm for `-XDeriveFunctor`. This is techincally a breaking change for users of `-XDeriveFoldable` and `-XDeriveTraversable`, since if someone was using a law-breaking `Monoid` instance with a derived `Foldable` instance (i.e., one where `x <> mempty` does not equal `x`) or a law-breaking `Applicative` instance with a derived `Traversable` instance, then the new generated code could result in different behavior. I suspect the number of scenarios like this is very small, and the onus really should be on those users to fix up their `Monoid`/`Applicative` instances. Fixes #11174. Test Plan: ./validate Reviewers: hvr, simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1908 GHC Trac Issues: #11174
* Derive Eq and Ord instance for SrcLoc and RealSrcLocGabriel Gonzalez2016-02-171-28/+2
| | | | | | | | | | | | | | The Eq and Ord instance were previously hand-written and this change updates them to be automatically derived by the compiler. The derived behavior should be equivalent to the original. Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1913
* Fix #11313.Richard Eisenberg2016-02-174-29/+55
| | | | | Previously, we looked through synonyms when counting arguments, but that's a bit silly.
* Fix #11246.Richard Eisenberg2016-02-173-38/+66
| | | | | | | We have to instantiate any invisible arguments to type families right away. This is now done in tcTyCon in TcHsType. testcase: typecheck/should_compile/T11246
* Fix #11241.Richard Eisenberg2016-02-171-1/+8
| | | | | | | When renaming a type, now looks for wildcards in bound variables' kinds. testcase: dependent/should_compile/T11241
* Use CoercionN and friends in TyCoRepRichard Eisenberg2016-02-172-20/+21
|
* Add missing kind cast to pure unifier.Richard Eisenberg2016-02-171-1/+1
|
* Existentials should be specified.Richard Eisenberg2016-02-171-1/+1
| | | | This addresses point (2) from #11513.
* Make exactTyCoVarsOfTypes closed over kinds.Richard Eisenberg2016-02-171-1/+1
|
* Small refactor and commentsSimon Peyton Jones2016-02-171-9/+25
| | | | Related to the fix to Trac #9611
* Simplify the defn of coreViewOneStarKindSimon Peyton Jones2016-02-171-6/+5
| | | | | I discussed it with Richard, but this version is much simmpler and more efficient.
* Comments onlySimon Peyton Jones2016-02-171-1/+1
|
* DynFlags: Don't panic on incompatible Safe Haskell flagsBen Gamari2016-02-161-1/+1
| | | | | | | | | | | | | | | | | We just return an arbitrary value since we are destined to fail due to the error anyways. Fixes #11580. Test Plan: Needs to be tested Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1925 GHC Trac Issues: #11580
* Suggest candidate instances in error messageYuras Shumovich2016-02-161-5/+24
| | | | | | | | | | | | | | | | | | See Trac #9611. In "No instance..." error message we suggest instances for other types with the same occ name. It is usefull e.g. when we have two different versions of the same package installed. Test Plan: typecheck/should_fail/tcfail224 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1919 GHC Trac Issues: #9611
* Fix typosRik Steenkamp2016-02-1610-25/+25
| | | | | | | | | | Reviewers: bgamari, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1915
* Fix two wrong uses of "data constructor" in error msgsRik Steenkamp2016-02-163-9/+15
| | | | | | | | | | | | | | | | | | | Replace `NoDataKinds :: PromotionErr` by `NoDataKindsTC` and `NoDataKindsDC` (just like there is `NoTypeInTypeTC` and `NoTypeInTypeDC`). This allows for a correct error message when a kind signature contains a type constructor and `-XDataKinds` is not specified. Apply a small fix to `TcError.hs` where instead of "data constructor" we should say "pattern synonym". Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D1909
* Improved error message about exported type operators.Ulya Trofimovich2016-02-162-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | There is ambiguty between (1) type constructors and (2) data constructors in export lists, e.g. '%%' can stand for both of them. This ambiguity is resolved in favor of (2). If the exported data constructor is not in scope, but type constructor with the same name is in scope, GHC should suggest adding 'type' keyword to resolve ambiguity in favor of (1) and enabling 'TypeOperators' extension. The patch only extends the error message. See Trac #11432. Test Plan: `make test` Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: mpickering, thomie, goldfire, kosmikus Differential Revision: https://phabricator.haskell.org/D1902 GHC Trac Issues: #11432
* Rename missing-pat-syn-sigs to missing-pat-syn-signaturesMatthew Pickering2016-02-151-1/+1
|
* A tiny, outright bug in tcDataFamInstDeclSimon Peyton Jones2016-02-153-13/+20
| | | | | | | | | | | | | | This bug was revealed by Trac #11362. It turns out that in my patch for Trac #11148 (namely 1160dc5), I failed to turn one occurrence of tvs' into full_tvs. Sigh. This is tricky stuff and it cost me several hours to page it back in and figure out what was happening. The result was a CoAxiom whose lhs had rhs had different kinds. Eeek! Anyway it's fixed. I also added an ASSERT, in FamInst.newFamInst, that trips on such bogus CoAxioms.
* Comments and white spaceSimon Peyton Jones2016-02-151-2/+7
|
* Tiny refactor; use guards instead of 'if'Simon Peyton Jones2016-02-151-7/+7
|
* Comments onlySimon Peyton Jones2016-02-152-6/+19
|
* Improve error message suppressionSimon Peyton Jones2016-02-151-7/+12
| | | | | | | | | TcErrors has a system for suppressing some type errors if a more serious one occurs. But there was a crucial missing case, which sometimes resulted in a cascade of irrelevant errors overwhelming the actual cause. This was Trac #11541. The fix is simple. Worth merging to 8.0
* renamer discards name location for HsRecFieldAlan Zimmerman2016-02-141-2/+3
| | | | | | | When renaming a HsVar it can be converted to a HsRecField. In the process the location of the enclosed name is converted to a noLoc Closes #11576
* Minor refactoring to tauifyMultipleMatchesSimon Peyton Jones2016-02-122-16/+15
| | | | No change in behaviour
* Improve pretty-printing of HsWrappersSimon Peyton Jones2016-02-125-50/+60
| | | | | | | | Reduces un-neede parens. Also -fprint-typechecker-elaboration now makes type applications and casts in expressions also appear. (Previously those were confusingly controlled by -fprint-explicit-coercions.)
* Simplify AbsBinds wrappingSimon Peyton Jones2016-02-126-251/+185
| | | | | | | | | | | | | | | | | | | | | | In poking Trac #11414 I found myself sinking into the abe_inst_wrap swamp. What is this strange thing? (It turned out that #11414 was breaking because of it.) Thrillingly, I found a way to sweep it away again, putting the deep instantation into tcMonoBinds instead of mkExport; and it turned out that the fun_co_fn field of FunBind was already there ready to receive exactly this wrapper. Hooray. Result * Death to abe_inst_wrap * Death to mbi_orig * Death to the plumbing in tcPolyInfer that did the deep instantiation I did find that I had to re-engineer the treatment of instance type signatures (again), but the result looks more modular and robust to me. And #11414 is fixed.
* Revert "Build the substitution correctly in piResultTy"Bartosz Nitka2016-02-121-20/+6
| | | | | | | | | | | | | This reverts commit dbf72dbc6e49b3db7f2337a7a41e95c1d0169163. This commit introduced performance regressions: https://ghc.haskell.org/trac/ghc/ticket/11371#comment:27, I will push it again after I fix it. Test Plan: revert Reviewers: simonpj, bgamari, simonmar, austin, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D1907
* Revert "sizeExpr: fix a bug in the size calculation"Simon Marlow2016-02-121-15/+3
| | | | This reverts commit 51a33924fc118d9b6c1db556c75c0d010ef95e18.
* Build the substitution correctly in piResultTyBartosz Nitka2016-02-111-6/+20
| | | | | | | | | | | | | | | | | | This fixes a bug where piResultTy created substitutions that would violate both of the invariants in Note [The substitution invariant]. Test Plan: ./validate --slow Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: simonmar, thomie Differential Revision: https://phabricator.haskell.org/D1855 GHC Trac Issues: #11371
* Another batch of typo fixes in non-codeGabor Greif2016-02-1110-10/+10
|
* compiler: Do not suggest nor complete deprecated flags fix trac issue #11454Nikita Kartashov2016-02-111-545/+772
| | | | | | | | | | | | | | Previously, all flags were present in user suggest and completion. This commit removes the deprecated ones from there. It is done by saving deprecation info at the moment of flag definition. Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D1883
* sizeExpr: fix a bug in the size calculationSimon Marlow2016-02-111-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | There were two bugs here: * We weren't ignoring Cast in size_up_app * An application of a non-variable wasn't being charged correct The result was that some things looked too cheap. In my case I had things like ((f x) `cast` ...) y which was given size 21 instead of 30, and this had knock-on effects elsewhere that caused some large code bloat. Test Plan: * nofib runs (todo) * validate Reviewers: simonpj, austin, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1900 GHC Trac Issues: #11564
* Comments about ru_autoSimon Peyton Jones2016-02-112-13/+16
| | | | ...following a question from Conal