summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Experiment with one-byte info tableswip/rwbarton-tiny-tablesReid Barton2016-02-292-1/+16
|
* DynFlags: Add -Wredundant-constraints to -WallBen Gamari2016-02-291-1/+2
| | | | | | | | | | | | Test Plan: It works, I promise. Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1956 GHC Trac Issues: #11370
* Refactor `warnMissingSignatures` in `RnNames.hs`Rik Steenkamp2016-02-291-69/+32
| | | | | | | | Reviewers: austin, thomie, bgamari Reviewed By: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1955
* Default to -fno-show-warning-groups (re #10752)Herbert Valerio Riedel2016-02-271-2/+1
| | | | | | | | | | | | | | | | | | As `-fno-show-warning-groups` shows associated warning groups regardless of whether the respective warning group flag as been passed on the CLI, the warning-group information may be confusing to users. At this point, `-fshow-warning-groups` is useful mostly to GHC developers and possibly GHC users who want to see which warning groups an emitted warning is part of. (Btw, this is particularly interesting in combination with `-Weverything` which enables *every* warning flag known to GHC.) Consequently, starting with this commit, one has to opt-in via `-fshow-warning-groups` for GHC to show warning groups. In order to reduce the testsuite delta in this commit, the `-fshow-warning-groups` flag has been added to TEST_HC_OPTS.
* Annotate `[-Wdeferred-type-errors]` in warnings (re #10752)Herbert Valerio Riedel2016-02-271-1/+1
| | | | This was missed in bb5afd3c274011c5ea302210b4c290ec1f83209c
* Print which flag controls emitted SafeHaskell warningsHerbert Valerio Riedel2016-02-271-5/+9
| | | | | | | This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover SafeHaskell warnings. This implements yet another part of #10752
* Annotate `[-Wredundant-constraints]` in warnings (re #10752)Herbert Valerio Riedel2016-02-271-2/+2
| | | | This was missed in bb5afd3c274011c5ea302210b4c290ec1f83209c
* Print which flag controls emitted lexer warningsHerbert Valerio Riedel2016-02-271-2/+4
| | | | | | | This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover warnings emitted during lexing. This implements another part of #10752
* Print which flag controls emitted desugaring warningsHerbert Valerio Riedel2016-02-277-42/+58
| | | | | | | | | | | This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover warnings emitted during the desugaring phase. This implements another part of #10752 Reviewed-by: quchen, bgamari Differential Revision: https://phabricator.haskell.org/D1954
* Filter out BuiltinRules in occurrence analysisSimon Peyton Jones2016-02-261-0/+14
| | | | Fixes Trac #11651. Merge to 8.0.
* Fix kind generalisation for pattern synonymsSimon Peyton Jones2016-02-261-13/+22
| | | | | | | | We were failing to zonk, after quantifyTyVars, and that left un-zonked type variables in the final PatSyn. This fixes the patsyn/ problems in Trac #11648, but not the polykinds/ ones.
* Comments and white space onlySimon Peyton Jones2016-02-261-8/+10
|
* Exclude TyVars from the constraint solverSimon Peyton Jones2016-02-263-34/+81
| | | | | | | | | | | | | | There is a general invariant that the constraint solver doesn't see TyVars, only TcTyVars. But when checking the generic-default signature of a class, we called checkValidType on the generic-default type, which had the class TyVar free. That in turn meant that it wasn't considered during flattening, which led to the error reported in Trac #11608. The fix is simple: call checkValidType on the /closed/ type. Easy. While I was at it, I added a bunch of ASSERTs about the TcTyVar invariant.
* Get the right in-scope set in specUnfoldingSimon Peyton Jones2016-02-262-5/+20
| | | | This fixes Trac #11600
* Special case for desugaring AbsBindsSimon Peyton Jones2016-02-261-0/+20
| | | | | | | | When AbsBinds has no tyvars and no dicts, a rather simpler desugaring is possible. This patch implements it. I don't think the optimised code changes, but there is less clutter generated.
* Fix and refactor strict pattern bindingsSimon Peyton Jones2016-02-266-202/+335
| | | | | | | | | | | | | | | | | | | | | | This patch was triggered by Trac #11601, where I discovered that -XStrict was really not doing the right thing. In particular, f y = let !(Just x) = blah[y] in body[y,x] This was evaluating 'blah' but not pattern matching it against Just until x was demanded. This is wrong. The patch implements a new semantics which ensures that strict patterns (i.e. ones with an explicit bang, or with -XStrict) are evaluated fully when bound. * There are extensive notes in DsUtils: Note [mkSelectorBinds] * To do this I found I need one-tuples; see Note [One-tuples] in TysWiredIn I updated the user manual to give the new semantics
* Typos in comments, etc.Gabor Greif2016-02-263-3/+3
|
* Unconditionally handle TH known key names.Edward Z. Yang2016-02-261-3/+1
| | | | | | | | | | | | | | | | | | | | | | Previously, we didn't add Template Haskell key names to the list of known uniques when building a stage 1 compiler. But with f16ddcee0c64a92ab911a7841a8cf64e3ac671fd we may refer to TH names even in stage 1, and this was causing uniques to not be setup properly. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate and run stage1 test suite Reviewers: osa1, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1520 GHC Trac Issues: #10382
* Print which warning-flag controls an emitted warningMichael Walker2016-02-2540-182/+371
| | | | | | | | | | | | | | | | | Both gcc and clang tell which warning flag a reported warning can be controlled with, this patch makes ghc do the same. More generally, this allows for annotated compiler output, where an optional annotation is displayed in brackets after the severity. This also adds a new flag `-f(no-)show-warning-groups` to control whether to show which warning-group (such as `-Wall` or `-Wcompat`) a warning belongs to. This flag is on by default. This implements #10752 Reviewed By: quchen, bgamari, hvr Differential Revision: https://phabricator.haskell.org/D1943
* Improve pattern synonym error messages (add `PatSynOrigin`)Rik Steenkamp2016-02-253-10/+40
| | | | | | | | | | | | | | | | | | Adds a new data constructor `PatSynOrigin Bool Name` to the `CtOrigin` data type. This allows for better error messages when the origin of a wanted constraint is a pattern synonym declaration. Fixes T10873. Reviewers: mpickering, simonpj, austin, thomie, bgamari Reviewed By: simonpj, thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1866 GHC Trac Issues: #10873
* Improve accuracy of suggestion to use TypeApplicationsMatthew Pickering2016-02-251-6/+7
| | | | | | | | | | | | | | | | The suggestion only makes sense when we try to use an as pattern in an expression context. It is misleading in the case of a lazy pattern and view pattern. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1948
* Handle multiline named haddock comments properlyThomas Miedema2016-02-251-15/+28
| | | | | | | | | | | | | Fixes #10398 in a different way, thereby also fixing #11579. I inverted the logic of the Bool argument to "worker", to hopefully make it more self-explanatory. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1935
* (Alternative way to) address #8710George Karachalias2016-02-251-19/+26
| | | | | | | | | | | | | | | | | | | | | | | | Issue a separate warning per redundant (or inaccessible) clause. This way each warning can have more precice location information (the location of the clause under consideration and not the whole match). I thought that this could be too much but actually the number of such warnings is bound by the number of cases matched against (in contrast to the non-exhaustive warnings which may be exponentially more). Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1920 GHC Trac Issues: #8710
* cmpTypeX: Avoid kind comparison when possibleBen Gamari2016-02-251-25/+60
| | | | | | | | | | | | | | | | | | This comparison is only necessary when the types being compared contain casts. Otherwise the structural equality of the types implies that their kinds are equal. Test Plan: Validate Reviewers: goldfire, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1944 GHC Trac Issues: #11597
* Reconstruct record expression in bidir pattern synonymMatthew Pickering2016-02-252-8/+26
| | | | | | | | | | Reviewers: austin, rdragon, bgamari Reviewed By: bgamari Subscribers: rdragon, thomie Differential Revision: https://phabricator.haskell.org/D1949
* Make warning names more consistentManav Rathi2016-02-254-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace "Sigs" with "Signatures" in WarningFlag data constructors. - Replace "PatSyn" with "PatternSynonym" in WarningFlag data constructors. - Deprecate "missing-local-sigs" in favor of "missing-local-signatures". - Deprecate "missing-exported-sigs" in favor of "missing-exported-signatures". - Deprecate "missing-pat-syn-signatures" in favor of "missing-pattern-synonym-signatures". - Replace "ddump-strsigs" with "ddump-str-signatures" These complete the tasks that were explicitly mentioned in #11583 Test Plan: Executed `ghc --show-options` and verified that the flags were changed as expected. Reviewers: svenpanne, austin, bgamari Reviewed By: austin, bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D1939 GHC Trac Issues: #11583
* HscMain: Delete some unused codeÖmer Sinan Ağacan2016-02-251-68/+0
| | | | | | | | | | Reviewers: bgamari, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1936
* ApplicativeDo: Handle terminal `pure` statementsBen Gamari2016-02-251-1/+1
| | | | | | | | | | | | | | | | | ApplicativeDo handled terminal `return` statements properly, but not `pure`. Test Plan: Validate with included testcase Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1931 GHC Trac Issues: #11607
* Overload the static form to reduce verbosity.Facundo Domínguez2016-02-252-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static pointers are rarely used naked: most often they are defined at the base of a Closure, as defined in e.g. the distributed-closure and distributed-static packages. So a typical usage pattern is: distributeMap (closure (static (\x -> x * 2))) which is more verbose than it needs to be. Ideally we'd just have to write distributeMap (static (\x -> x * 2)) and let the static pointer be lifted to a Closure implicitly. i.e. what we want is to overload static literals, just like we already overload list literals and string literals. This is achieved by introducing the IsStatic type class and changing the typing rule for static forms slightly: static (e :: t) :: IsStatic p => p t Test Plan: ./validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: simonpj, mboes, thomie Differential Revision: https://phabricator.haskell.org/D1923 GHC Trac Issues: #11585
* TyCoRep: Add haddock sectionsBen Gamari2016-02-251-5/+5
|
* Remove "use mask" from StgAlt syntaxÖmer Sinan Ağacan2016-02-248-42/+25
| | | | | | | | | | Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1933
* 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.