summaryrefslogtreecommitdiff
path: root/compiler/utils
Commit message (Collapse)AuthorAgeFilesLines
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-281-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* cpp: Use #pragma once instead of #ifndef guardsBen Gamari2017-04-231-7/+1
| | | | | | | | | | | | | | This both says what we mean and silences a bunch of spurious CPP linting warnings. This pragma is supported by all CPP implementations which we support. Reviewers: austin, erikd, simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3482
* Caret diag.: Avoid decoding whole module if only specific line is neededalexbiehl2017-04-171-1/+39
| | | | | | | | | | | | | | | | | Before we were decoding the whole file to get to the desired line. This patch introduces a fast function which searches a StringBuffer for the desired line so we only need to utf8 decode a little portion. This is especially interesting if we have big modules with lots of warnings. Reviewers: austin, bgamari, Rufflewind, trofi Reviewed By: Rufflewind, trofi Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3440
* Use intersect and minus instead of filterBartosz Nitka2017-04-172-3/+6
| | | | | | | | | | | | | | | These are asymptotically better and convey the intent a bit better. Test Plan: ./validate Reviewers: simonpj, bgamari, austin, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie, simonmar Differential Revision: https://phabricator.haskell.org/D3455
* utils: Lazily decode UTF8 stringsBen Gamari2017-04-173-17/+25
| | | | | | | | | | Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13527 Differential Revision: https://phabricator.haskell.org/D3442
* Drop special handling of iOSMoritz Angermann2017-04-121-8/+1
| | | | | | | | | | | | | | | | | | | | iOS at least since iOS8 (we are currently at iOS10.3), allows for dynamic libaries, hence any artificail restriction on dyanmic libraries should be lifted. Please ping me with any iOS related issues that should potentially resurface. The iOS toolchain has considerably changed over the years, and I'm willing to drop work arounds in good faith. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13559, #7722 Differential Revision: https://phabricator.haskell.org/D3451
* Revert "Enable new warning for fragile/incorrect CPP #if usage"Ben Gamari2017-04-051-1/+1
| | | | | | | | This is causing too much platform dependent breakage at the moment. We will need a more rigorous testing strategy before this can be merged again. This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.
* Typos in comments [ci skip]Gabor Greif2017-04-051-1/+1
|
* Replace Digraph's Node type synonym with a data typeMatthew Pickering2017-04-041-14/+16
| | | | | | | | | | | | | This refactoring makes it more obvious when we are constructing a Node for the digraph rather than a less useful 3-tuple. Reviewers: austin, goldfire, bgamari, simonmar, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3414
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-051-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* FastMutInt: fix Int and Ptr sizes when crosscompilingSergei Trofimovich2017-04-021-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to https://ghc.haskell.org/trac/ghc/ticket/13491 https://phabricator.haskell.org/D3122 SIZEOF_HSINT and SIZEOF_VOID_P are sizes of target platform. These values are usually not correct when stage1 is built. It means the code ```haskell newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } where !(I# size) = SIZEOF_HSINT ``` would try to allocate only 4 bytes on 64-bit-host targeting 32-bit system. It does not matter in practice as newByteArray# implementation rounds up passed value to host's word size. But one day it might not. To prevent this class of problems in compiler/ directory 'MachDeps.h' contents is hidden when ghc-stage1 (-DSTAGE=1) is built. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Reviewers: austin, rwbarton, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3405
* Fixed error messages for RecursiveDo (#8501)Rupert Horlick2017-03-291-0/+15
| | | | | | | | | | | | | | | | | Changes in a few different places to catch several different types of error related to RecursiveDo Signed-off-by: Rupert Horlick <ruperthorlick@gmail.com> Test Plan: Three test cases, with further tests in comments Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3271
* Allow colors to be customizedPhil Ruffwind2017-03-233-72/+118
| | | | | | | | | | | | | | | | | | Allow customization of diagnostic colors through the GHC_COLORS environment variable. Some color-related code have been refactored to PprColour to reduce the circular dependence between DynFlags, Outputable, ErrUtils. Some color functions that were part of Outputable but were never used have been deleted. Test Plan: validate Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3364
* UniqMap implementation.Edward Z. Yang2017-03-201-0/+210
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Introduce and use EnumSet in DynFlagsBen Gamari2017-03-151-0/+33
| | | | | | | | | | | | | | | This factors out a repeated pattern found in DynFlags, where we use an IntSet and Enum to represent sets of flags. Requires bump of haddock submodule. Test Plan: validate Reviewers: austin, goldfire Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3331
* Reimplement minusList using SetDavid Feuer2017-03-141-3/+27
| | | | | | | | | | | | | `minusList ms ns` was `O(m*n)`. Now it's `O((m + n) log n)`, which should be a bit better. Reviewers: austin, bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3341
* Typos in manual and commentsGabor Greif2017-03-142-2/+2
|
* Replace debugging trace with a proper WARNMatthew Pickering2017-03-132-2/+10
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3326
* Remove `runs` function which already exists in baseÖmer Sinan Ağacan2017-03-121-19/+2
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3320
* Fix TcSimplify.decideQuantification for kind variablesSimon Peyton Jones2017-03-101-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TcSimplify.decideQuantification was doing the Wrong Thing when "growing" the type variables to quantify over. We were trying to do this on a tyvar set where we'd split off the dependent type varaibles; and we just got it wrong. A kind variable wasn't being generalised properly, with confusing knock on consequences. All this led to Trac #13371 and Trac #13393. This commit tidies it all up: * The type TcDepVars is renamed as CandidateQTvs; and splitDepVarsOfType to candidateQTyVarsOfType * The code in TcSimplify.decideQuantification is simpler. It no longer does the tricky "grow" stuff over TcDepVars. Instead it use ordinary VarSets (thereby eliminating the nasty growThetaTyVarsDSet) and uses that to filter the result of candidateQTyVarsOfType. * I documented that candidateQTyVarsOfType returns the type variables in a good order in which to quantify, and rewrote it to use an accumulator pattern, so that we would predicatably get left-to-right ordering. In doing all this I also made UniqDFM behave a little more nicely: * When inserting an element that is there already, keep the old tag, while still overwriting with the new value. * This means that when doing udfmToList we get back elements in the order they were originally inserted, rather than in reverse order. It's not a big deal, but in a subsequent commit I use it to improve the order of type variables in inferred types. All this led to a lot of error message wibbles: - changing the order of quantified variables - changing the order in which instances are listed in GHCi - changing the tidying of variables in typechecker erors There's a submodule update for 'array' because one of its tests has an error-message change. I may not have associated all of them with the correct commit.
* Read COMPLETE sets from external packagesBen Gamari2017-03-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | Currently, `COMPLETE` pragmas are not read from external packages at all, which quite limits their usefulness. This extends `ExternalPackageState` to include `COMPLETE` sets from other packages, and plumbs around the appropriate values to make it work the way you'd expect it to. Requires a `binary` submodule update. Fixes #13350. Test Plan: make test TEST=T13350 Reviewers: rwbarton, mpickering, austin, simonpj, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3257
* Revert "Read COMPLETE sets from external packages"Ben Gamari2017-03-031-0/+1
| | | | This reverts commit 0d2f733050ff656b827351108d988e09abc363fc.
* Read COMPLETE sets from external packagesRyan Scott2017-03-021-1/+0
| | | | | | | | | | | | | | | | | | | | Currently, `COMPLETE` pragmas are not read from external packages at all, which quite limits their usefulness. This extends `ExternalPackageState` to include `COMPLETE` sets from other packages, and plumbs around the appropriate values to make it work the way you'd expect it to. Fixes #13350. Test Plan: make test TEST=T13350 Reviewers: rwbarton, mpickering, austin, simonpj, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3257
* Eliminate ListSetOps from imp_trust_pkgsDavid Feuer2017-03-021-5/+1
| | | | | | | | | | | | | | Eliminate ListSetOps from imp_trust_pkgs and imp_dep_pkgs Replace Map with NameEnv in TmOracle Reviewers: austin, dfeuer, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3113
* Upgrade UniqSet to a newtypeDavid Feuer2017-03-016-43/+121
| | | | | | | | | | | | | | | | | | | | | The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet` has a key invariant `UniqFM` does not. For example, `fmap` over `UniqSet` will generally produce nonsense. * Upgrade `UniqSet` from a type synonym to a newtype. * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`. * Use cached unique in `tyConsOfType` by replacing `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`. Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3146
* Use half as much memory when reading interfacesReid Barton2017-02-231-1/+1
| | | | | | | | | | | | | | | I don't see any reason for the (filesize*2), and experimentally allocations do go down slightly after this change. Test Plan: validate Reviewers: simonmar, austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: trofi, thomie Differential Revision: https://phabricator.haskell.org/D3164
* Type-indexed TypeableBen Gamari2017-02-182-4/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This at long last realizes the ideas for type-indexed Typeable discussed in A Reflection on Types (#11011). The general sketch of the project is described on the Wiki (Typeable/BenGamari). The general idea is that we are adding a type index to `TypeRep`, data TypeRep (a :: k) This index allows the typechecker to reason about the type represented by the `TypeRep`. This index representation mechanism is exposed as `Type.Reflection`, which also provides a number of patterns for inspecting `TypeRep`s, ```lang=haskell pattern TRFun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). (k ~ Type, fun ~~ (arg -> res)) => TypeRep arg -> TypeRep res -> TypeRep fun pattern TRApp :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b) => TypeRep a -> TypeRep b -> TypeRep t -- | Pattern match on a type constructor. pattern TRCon :: forall k (a :: k). TyCon -> TypeRep a -- | Pattern match on a type constructor including its instantiated kind -- variables. pattern TRCon' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a ``` In addition, we give the user access to the kind of a `TypeRep` (#10343), typeRepKind :: TypeRep (a :: k) -> TypeRep k Moreover, all of this plays nicely with 8.2's levity polymorphism, including the newly levity polymorphic (->) type constructor. Library changes --------------- The primary change here is the introduction of a Type.Reflection module to base. This module provides access to the new type-indexed TypeRep introduced in this patch. We also continue to provide the unindexed Data.Typeable interface, which is simply a type synonym for the existentially quantified SomeTypeRep, data SomeTypeRep where SomeTypeRep :: TypeRep a -> SomeTypeRep Naturally, this change also touched Data.Dynamic, which can now export the Dynamic data constructor. Moreover, I removed a blanket reexport of Data.Typeable from Data.Dynamic (which itself doesn't even import Data.Typeable now). We also add a kind heterogeneous type equality type, (:~~:), to Data.Type.Equality. Implementation -------------- The implementation strategy is described in Note [Grand plan for Typeable] in TcTypeable. None of it was difficult, but it did exercise a number of parts of the new levity polymorphism story which had not yet been exercised, which took some sorting out. The rough idea is that we augment the TyCon produced for each type constructor with information about the constructor's kind (which we call a KindRep). This allows us to reconstruct the monomorphic result kind of an particular instantiation of a type constructor given its kind arguments. Unfortunately all of this takes a fair amount of work to generate and send through the compilation pipeline. In particular, the KindReps can unfortunately get quite large. Moreover, the simplifier will float out various pieces of them, resulting in numerous top-level bindings. Consequently we mark the KindRep bindings as noinline, ensuring that the float-outs don't make it into the interface file. This is important since there is generally little benefit to inlining KindReps and they would otherwise strongly affect compiler performance. Performance ----------- Initially I was hoping to also clear up the remaining holes in Typeable's coverage by adding support for both unboxed tuples (#12409) and unboxed sums (#13276). While the former was fairly straightforward, the latter ended up being quite difficult: while the implementation can support them easily, enabling this support causes thousands of Typeable bindings to be emitted to the GHC.Types as each arity-N sum tycon brings with it N promoted datacons, each of which has a KindRep whose size which itself scales with N. Doing this was simply too expensive to be practical; consequently I've disabled support for the time being. Even after disabling sums this change regresses compiler performance far more than I would like. In particular there are several testcases in the testsuite which consist mostly of types which regress by over 30% in compiler allocations. These include (considering the "bytes allocated" metric), * T1969: +10% * T10858: +23% * T3294: +19% * T5631: +41% * T6048: +23% * T9675: +20% * T9872a: +5.2% * T9872d: +12% * T9233: +10% * T10370: +34% * T12425: +30% * T12234: +16% * 13035: +17% * T4029: +6.1% I've spent quite some time chasing down the source of this regression and while I was able to make som improvements, I think this approach of generating Typeable bindings at time of type definition is doomed to give us unnecessarily large compile-time overhead. In the future I think we should consider moving some of all of the Typeable binding generation logic back to the solver (where it was prior to 91c6b1f54aea658b0056caec45655475897f1972). I've opened #13261 documenting this proposal.
* Simplify OutputableBndrSimon Peyton Jones2017-02-171-12/+6
| | | | | | | | | This replaces three methods in OutputableBndr with one, and adds comments. There's also a tiny change in the placement of equals signs in debug-prints. I like it better that way, but if it complicates life for anyone we can put it back.
* Implement HasField constraint solving and modify OverloadedLabelsAdam Gundry2017-02-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This implements automatic constraint solving for the new HasField class and modifies the existing OverloadedLabels extension, as described in the GHC proposal (https://github.com/ghc-proposals/ghc-proposals/pull/6). Per the current form of the proposal, it does *not* currently introduce a separate `OverloadedRecordFields` extension. This replaces D1687. The users guide documentation still needs to be written, but I'll do that after the implementation is merged, in case there are further design changes. Test Plan: new and modified tests in overloadedrecflds Reviewers: simonpj, goldfire, dfeuer, bgamari, austin, hvr Reviewed By: bgamari Subscribers: maninalift, dfeuer, ysangkok, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2708
* Setup more error context for Backpack operations.Edward Z. Yang2017-02-121-1/+10
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: bgamari, simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3101
* Binary: Correct endian issue when cross-compilingalexbiehl2017-02-111-30/+55
| | | | | | | | | | | | | | Using `WORDS_BIGENDIAN` wasn't such a great idea after all! When cross compiling host and target endianess may differ and `WORDS_BIGENDIAN` refers to host endianess. Reviewers: austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: rwbarton, trofi, thomie Differential Revision: https://phabricator.haskell.org/D3122
* Binary: Only allocate un-interned FastStringsalexbiehl2017-02-111-2/+3
| | | | | | | | | | | | Test Plan: Validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3109
* Use proper primitives in Utils.Binaryalexbiehl2017-02-051-93/+96
| | | | | | | | | | | | | | `Word{16,32,64}` are implemented using `getWord8`. This patch introduces `getWord{16,32,64}` and `putWord{16,32,64}`. This is nicer and probably a bit faster. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2908
* Ditch static flagsSylvain Henry2017-02-021-28/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440
* Spelling fixesGabor Greif2017-02-021-1/+1
|
* Join pointsLuke Maurer2017-02-012-0/+23
| | | | | | | | | | | | | | | | | | | This major patch implements Join Points, as described in https://ghc.haskell.org/trac/ghc/wiki/SequentCore. You have to read that page, and especially the paper it links to, to understand what's going on; but it is very cool. It's Luke Maurer's work, but done in close collaboration with Simon PJ. This Phab is a squash-merge of wip/join-points branch of http://github.com/lukemaurer/ghc. There are many, many interdependent changes. Reviewers: goldfire, mpickering, bgamari, simonmar, dfeuer, austin Subscribers: simonpj, dfeuer, mpickering, Mikolaj, thomie Differential Revision: https://phabricator.haskell.org/D2853
* Export callStackDocBen Gamari2017-01-311-1/+1
| | | | | | | | | | | | | | | | It's generally a pretty useful thing to have around. [skip ci] Test Plan: Build it Reviewers: austin, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3048
* Add a flag to emit error messages as JSONMatthew Pickering2017-01-301-0/+54
| | | | | | | | | | | | | | | | | | | | | This patch adds the flag `-ddump-json` which dumps all the compiler output as a JSON array. This allows tooling to more easily parse GHC's output to display to users. The flag is currently experimental and will hopefully be refined for the next release. In particular I have avoided any changes which involve significant refactoring and provided what is easy given the current infrastructure. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: DanielG, gracjan, thomie Differential Revision: https://phabricator.haskell.org/D3010 GHC Trac Issues: #13190
* Fix deprecation warnings from containersErik de Castro Lopo2017-01-303-8/+8
| | | | | | | | | | | | | | | The functions that were causing warnings were deprecated in containers 0.5 and GHC is already using containers 0.5.9.1. Test Plan: validate Reviewers: rwbarton, bgamari, hsyl20, austin, dfeuer Reviewed By: dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3036
* UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldrBen Gamari2017-01-241-4/+4
| | | | | | | | | | | | | | | | | | | | foldr generally isn't a good choice for folds where the result can't be consumed incrementally. This gives a very modest improvement in compiler allocations, ``` -1 s.d. ----- -0.182% +1 s.d. ----- -0.050% Average ----- -0.116% ``` This is clearly semantics-preserving since we are constructing a set. Test Plan: Validate Reviewers: austin Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2965
* Update levity polymorphismRichard Eisenberg2017-01-192-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the proposal in https://github.com/ghc-proposals/ghc-proposals/pull/29 and https://github.com/ghc-proposals/ghc-proposals/pull/35. Here are some of the pieces of that proposal: * Some of RuntimeRep's constructors have been shortened. * TupleRep and SumRep are now parameterized over a list of RuntimeReps. * This means that two types with the same kind surely have the same representation. Previously, all unboxed tuples had the same kind, and thus the fact above was false. * RepType.typePrimRep and friends now return a *list* of PrimReps. These functions can now work successfully on unboxed tuples. This change is necessary because we allow abstraction over unboxed tuple types and so cannot always handle unboxed tuples specially as we did before. * We sometimes have to create an Id from a PrimRep. I thus split PtrRep * into LiftedRep and UnliftedRep, so that the created Ids have the right strictness. * The RepType.RepType type was removed, as it didn't seem to help with * much. * The RepType.repType function is also removed, in favor of typePrimRep. * I have waffled a good deal on whether or not to keep VoidRep in TyCon.PrimRep. In the end, I decided to keep it there. PrimRep is *not* represented in RuntimeRep, and typePrimRep will never return a list including VoidRep. But it's handy to have in, e.g., ByteCodeGen and friends. I can imagine another design choice where we have a PrimRepV type that is PrimRep with an extra constructor. That seemed to be a heavier design, though, and I'm not sure what the benefit would be. * The last, unused vestiges of # (unliftedTypeKind) have been removed. * There were several pretty-printing bugs that this change exposed; * these are fixed. * We previously checked for levity polymorphism in the types of binders. * But we also must exclude levity polymorphism in function arguments. This is hard to check for, requiring a good deal of care in the desugarer. See Note [Levity polymorphism checking] in DsMonad. * In order to efficiently check for levity polymorphism in functions, it * was necessary to add a new bit of IdInfo. See Note [Levity info] in IdInfo. * It is now safe for unlifted types to be unsaturated in Core. Core Lint * is updated accordingly. * We can only know strictness after zonking, so several checks around * strictness in the type-checker (checkStrictBinds, the check for unlifted variables under a ~ pattern) have been moved to the desugarer. * Along the way, I improved the treatment of unlifted vs. banged * bindings. See Note [Strict binds checks] in DsBinds and #13075. * Now that we print type-checked source, we must be careful to print * ConLikes correctly. This is facilitated by a new HsConLikeOut constructor to HsExpr. Particularly troublesome are unlifted pattern synonyms that get an extra void# argument. * Includes a submodule update for haddock, getting rid of #. * New testcases: typecheck/should_fail/StrictBinds typecheck/should_fail/T12973 typecheck/should_run/StrictPats typecheck/should_run/T12809 typecheck/should_fail/T13105 patsyn/should_fail/UnliftedPSBind typecheck/should_fail/LevPolyBounded typecheck/should_compile/T12987 typecheck/should_compile/T11736 * Fixed tickets: #12809 #12973 #11736 #13075 #12987 * This also adds a test case for #13105. This test case is * "compile_fail" and succeeds, because I want the testsuite to monitor the error message. When #13105 is fixed, the test case will compile cleanly.
* Spelling fixes in comments [ci skip]Gabor Greif2017-01-181-1/+1
|
* Unbreak build with ghc-7.10.1Yuras Shumovich2017-01-171-0/+2
| | | | | | | | | | | | | | Test Plan: build with ghc-7.10.1 Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2976 GHC Trac Issues: #13120
* Revamp Backpack/hs-boot handling of type class signatures.Edward Z. Yang2017-01-111-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A basket of fixes and improvements: - The permissible things that one can write in a type class definition in an hsig file has been reduced to encompass the following things: - Methods - Default method signatures (but NOT implementation) - MINIMAL pragma It is no longer necessary nor encouraged to specify that a method has a default if it is mentioned in a MINIMAL pragma; the MINIMAL pragma is assumed to provide the base truth as to what methods need to be implemented when writing instances of a type class. - Handling of default method signatures in hsig was previously buggy, as these identifiers were not exported, so we now treat them similarly to DFuns. - Default methods are merged, where methods with defaults override those without. - MINIMAL pragmas are merged by ORing together pragmas. - Matching has been relaxed: a method with a default can be used to fill a signature which did not declare the method as having a default, and a more relaxed MINIMAL pragma can be used (we check if the signature pragma implies the final implementation pragma, on the way fixing a bug with BooleanFormula.implies, see #13073) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2925 GHC Trac Issues: #13041
* Fix terminal corruption bug and clean up SDoc interface.Phil Ruffwind2017-01-101-12/+39
| | | | | | | | | | | | | | | | | | | | | | | - Fix #13076 by wrapping `printDoc_` so that the terminal color is reset even if an exception occurs. - Add `printSDoc`, `printSDocLn`, and `bufLeftRenderSDoc` to keep `SDoc` values abstract (they are wrappers of `printDoc_`, `printDoc`, and `bufLeftRender` respectively). - Remove unused function: `printForAsm` Test Plan: manual Reviewers: RyanGlScott, austin, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: dfeuer, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2932 GHC Trac Issues: #13076
* Fix typo in commentSteffen Forkmann2017-01-101-1/+1
|
* Enable subsections via symbols on iOSDemi Obenour2017-01-101-0/+6
| | | | | | | | | | | | | | Test Plan: GHC CI Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2915 GHC Trac Issues: #11040, #13049
* Typos in comments (and in a test)Gabor Greif2017-01-091-3/+3
|
* Improve StringBuffer and FastString docsPhil Ruffwind2016-12-172-4/+51
| | | | | | | | | | | | | | | This area of code contains a lot of unsafe functionality, so it might be worth documenting to reduce the risk of misuse. Test Plan: inspection Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2872
* Typos in commentsGabor Greif2016-12-161-1/+1
|