summaryrefslogtreecommitdiff
path: root/compiler/rename
Commit message (Collapse)AuthorAgeFilesLines
...
* A raft of changes driven by Trac #8540Simon Peyton Jones2013-11-227-138/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The root cause of #8450 is that the new Template Haskell story, with the renamer doing more of the work of Template Haskell, wasn't dealing correctly with the keepAlive problem. Consider g = ..blah... f = [| g |] Then f's RHS refers to g's name but not to g, so g was being discarded as dead code. Fixing this sucked me into a deep swamp of understanding how all the moving parts of hte new Template Haskell fit together, leading to a large collection of related changes and better documentation. Specifically: * Instead of putting the TH level of a binder in the LocalRdrEnv, there is now a separate field tcl_th_bndrs :: NameEnv (TopLevelFlag, ThLevel) in the TcLclEnv, which records for each binder a) whether it is syntactically a top-level binder or not b) its TH level This deals uniformly with top-level and non-top-level binders, which was previously dealt with via greviously-delicate meddling with Internal and External Names. Much better. * As a result I could remove the tct_level field of ATcId. * There are consequential changes in TcEnv too, which must also extend the level bindings. Again, more clarity. I renamed TcEnv.tcExtendTcTyThingEnv to tcExtendKindEnv2, since it's only used during kind inference, for (AThing kind) and APromotionErr; and that is relevant to whether we want to extend the tcl_th_bndrs field (no). * I de-crufted the code in RnEnv.extendGlobalRdrEnv, by getting rid of the qual_gre code which said "Seems like 5 times as much work as it deserves!". Instead, RdrName.pickGREs makes the Internal names shadow External ones. * I moved the checkThLocalName cross-stage test to finishHsVar; previously we weren't doing the test at all in the OpApp case! * Quite a few changes (shortening the code) in the cross-stage checking code in TcExpr and RnSplice, notably to move the keepAlive call to the renamer One leftover piece: * In TcEnv I removed tcExtendGhciEnv and refactored tcExtendGlobalTyVars; this is really related to the next commit, but it was too hard to disentangle.
* Tidy up the error messages we get from TH in stage1 (Trac #8312)Simon Peyton Jones2013-11-066-69/+19
| | | | | | Instead of panic-ing we now give a sensible message. There is quite a bit of refactoring here too, removing several #ifdef GHCI things
* Fix checking of shadowed names (fixes Trac #8499)Simon Peyton Jones2013-11-051-13/+19
|
* Load all modules before reporting errors (#8322)Joachim Breitner2013-11-021-2/+2
| | | | | | Instead of reporting only one "module not found"" error. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix Trac #8485.Richard Eisenberg2013-10-292-29/+45
| | | | | | | | | | The problem was that the renamer treated role annotations by looking up the annotated type in the module being compiled. If this check succeeded, it was assumed that the annotated type was being compiled at the same time. But this assumption is false! In GHCi (and Template Haskell), sometimes compilation within one module can be staged. So, now there is a more intricate check for orphan role annotations. This also has the benefit of producing better error messages.
* Fix Trac #8448Simon Peyton Jones2013-10-231-3/+11
| | | | | | We weren't dealing with built-in syntax; data constructors that are built-in syntax (only [] actually) don't appear in the GlobalRdrEnv
* Reject negative type-level integers created via TH (#8412)Krzysztof Gogolewski2013-10-121-2/+7
| | | | This commit moves the check from parser to renamer.
* Remove tab.Geoffrey Mainland2013-10-041-1/+1
|
* Allow splices to add additional top-level declarations.Geoffrey Mainland2013-10-041-3/+12
|
* Add full support for declaration splices.Geoffrey Mainland2013-10-043-10/+55
| | | | | Since declaration splices are now untyped, they can be used anywhere a declaration is valid, including in declaration brackets.
* Add support for pattern splices.Geoffrey Mainland2013-10-043-5/+66
|
* Clean up error context when checking brackets/splices.Geoffrey Mainland2013-10-041-2/+6
|
* Track TH stage in the renamer.Geoffrey Mainland2013-10-043-104/+299
|
* Check the staging restriction in the renamer.Geoffrey Mainland2013-10-041-25/+133
|
* Differentiate typed and untyped splices and brackets in the abstract syntax.Geoffrey Mainland2013-10-041-2/+5
|
* Consolidate TH renaming.Geoffrey Mainland2013-10-044-29/+50
|
* Move renamer splice functionality into a separate module.Geoffrey Mainland2013-10-044-117/+151
| | | | This structure now matches that of the type checker.
* Globally replace "hackage.haskell.org" with "ghc.haskell.org"Simon Marlow2013-10-014-4/+4
|
* RnNames.lhs : Reuse existing function.Erik de Castro Lopo2013-09-281-10/+3
|
* Whitespace only.Erik de Castro Lopo2013-09-281-28/+28
|
* TyposKrzysztof Gogolewski2013-09-232-3/+3
|
* Implement checkable "minimal complete definitions" (#7633)Twan van Laarhoven2013-09-181-1/+26
| | | | | | | | | | | | | | This commit adds a `{-# MINIMAL #-}` pragma, which defines the possible minimal complete definitions for a class. The body of the pragma is a boolean formula of names. The old warning for missing methods is replaced with this new one. Note: The interface file format is changed to store the minimal complete definition. Authored-by: Twan van Laarhoven <twanvl@gmail.com> Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Change role annotation syntax.Richard Eisenberg2013-09-174-52/+125
| | | | | | | | | This fixes bugs #8185, #8234, and #8246. The new syntax is explained in the comments to #8185, appears in the "Roles" subsection of the manual, and on the [wiki:Roles] wiki page. This change also removes the ability for a role annotation on type synonyms, as noted in #8234.
* Give language pragma suggestions without -XJoachim Breitner2013-09-147-26/+26
| | | | for easier copy'n'paste. This fixes: #3647
* Fix AMP warnings.Austin Seipp2013-09-111-6/+13
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #7918Edsko de Vries2013-09-033-5/+10
|
* Detabify RnPat.lhsAustin Seipp2013-08-281-107/+106
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Implement -XNumDecimals (#7266)Austin Seipp2013-08-281-3/+16
| | | | | | | | | | | | | | | | | Under -XNumDecimals, it's possible to specify an integer literal using compact "floating point" syntax for any floating literal constant which also happens to be an integer. This lets us write 1.2e6 :: Integer instead of: 1200000 :: Integer This also makes some amendments to the users guide. Authored-by: Shachaf Ben-Kiki <shachaf@gmail.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Make `-ddump-minimal-imports` honour `-dumpdir` flagHerbert Valerio Riedel2013-08-271-2/+7
| | | | | | | | | | The `-dumpdir` flag was added via 668c860b361f16 but failed to take care of `-ddump-minimal-imports`'s output. This commit makes up for that omission. This addresses #7957 Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Strings and comments only: 'to to ' fixesGabor Greif2013-08-221-1/+1
| | | | I'd still prefer if a native english speaker would check them.
* Implement "roles" into GHC.Richard Eisenberg2013-08-021-11/+32
| | | | | | | | | | | | | | | | Roles are a solution to the GeneralizedNewtypeDeriving type-safety problem. Roles were first described in the "Generative type abstraction" paper, by Stephanie Weirich, Dimitrios Vytiniotis, Simon PJ, and Steve Zdancewic. The implementation is a little different than that paper. For a quick primer, check out Note [Roles] in Coercion. Also see http://ghc.haskell.org/trac/ghc/wiki/Roles and http://ghc.haskell.org/trac/ghc/wiki/RolesImplementation For a more formal treatment, check out docs/core-spec/core-spec.pdf. This fixes Trac #1496, #4846, #7148.
* Remove redundant parenthesesIan Lynagh2013-07-271-1/+1
|
* Further fixes in RnNames, to make associated type exports workSimon Peyton Jones2013-06-251-39/+27
| | | | | | | | | | | You ought to be able to say module M( C( T, foo ) where class C a where type T a foo :: a -> T a i.e. with T in C's sub-item list. This makes it so.
* Allow associated types as sub-names in an import list (Trac #8011)Simon Peyton Jones2013-06-242-14/+20
|
* Tidy up the segmentation of mdo expressionsSimon Peyton Jones2013-06-241-72/+93
| | | | | | | | When we changed 'rec' to *not* do segmentation of any kind, I did it by meddling with the inner loop of grab in glomSegments. But that is really hard to understand! This patch lifts the test out to the top where is is clear.
* Revise implementation of overlapping type family instances.Richard Eisenberg2013-06-211-10/+20
| | | | | | | | | | | | | | | | | | | This commit changes the syntax and story around overlapping type family instances. Before, we had "unbranched" instances and "branched" instances. Now, we have closed type families and open ones. The behavior of open families is completely unchanged. In particular, coincident overlap of open type family instances still works, despite emails to the contrary. A closed type family is declared like this: > type family F a where > F Int = Bool > F a = Char The equations are tried in order, from top to bottom, subject to certain constraints, as described in the user manual. It is not allowed to declare an instance of a closed family.
* Fix many ASSERT uses under Clang.Austin Seipp2013-06-182-11/+11
| | | | | | Clang doesn't like whitespace between macro and arguments. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Use ideclImplicit to filter out only *implict* Prelude imports (Trac #7963)Simon Peyton Jones2013-06-171-4/+1
| | | | | The ideclImplicit flag didn't exist before, but it does now, and it makes this code simpler and makes it easy to fix Trac #7963.
* UntabifyGeoffrey Mainland2013-06-031-248/+241
|
* UntabifyGeoffrey Mainland2013-06-031-388/+381
|
* Check for illegal syntax in types (fixes Trac #7943)Simon Peyton Jones2013-05-281-3/+4
|
* Give 'unboundName' a very low binding precedenceSimon Peyton Jones2013-05-281-15/+27
| | | | This fixes Trac #7937
* Comment typoSimon Peyton Jones2013-05-221-1/+1
|
* Modernise code in rename/RnEnv.lhsIan Lynagh2013-05-121-25/+18
| | | | Removed a definition of thenM, and used do notation instead
* Fix kind quantification (again)Simon Peyton Jones2013-05-031-7/+5
| | | | | | | | We simply weren't quantifying kind variables at the points we were claiming. In paritcular, in forall (a:k). blah we quantify the 'k' around the 'forall a', provided k isn't already in scope
* Fix type variable scoping in nested pattern type signatures (#7827)Patrick Palka2013-04-121-2/+11
|
* Rearrange the typechecking of arrows, especially arrow "forms"Simon Peyton Jones2013-03-042-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The typechecking of arrow forms (in GHC 7.6) is known to be bogus, as described in Trac #5609, because it marches down tuple types that may not yet be fully worked out, depending on when constraint solving happens. Moreover, coercions are generated and simply discarded. The fact that it works at all is a miracle. This refactoring is based on a conversation with Ross, where we rearranged the typing of the argument stack, so that the arrows have the form a (env, (arg1, (arg2, ...(argn, ())))) res rather than a (arg1, (arg2, ...(argn, env))) res as it was before. This is vastly simpler to typecheck; just look at the beautiful, simple type checking of arrow forms now! We need a new HsCmdCast to capture the coercions generated from the argument stack. This leaves us in a better position to tackle the open arrow tickets * Trac #5777 still fails. (I was hoping this patch would cure it.) * Trac #5609 is too complicated for me to grok. Ross? * Trac #344 * Trac #5333
* Fix a TODO in the compilerIan Lynagh2013-02-261-1/+2
| | | | AnnProvenance now has Functor, Foldable, Traversable instances.
* Add OverloadedLists, allowing list syntax to be overloadedSimon Peyton Jones2013-02-143-25/+59
| | | | | | | | | | | | | | | | | | | | | | | This work was all done by Achim Krause <achim.t.krause@gmail.com> George Giorgidze <giorgidze@gmail.com> Weijers Jeroen <jeroen.weijers@uni-tuebingen.de> It allows list syntax, such as [a,b], [a..b] and so on, to be overloaded so that it works for a variety of types. The design is described here: http://hackage.haskell.org/trac/ghc/wiki/OverloadedLists Eg. you can use it for maps, so that [(1,"foo"), (4,"bar")] :: Map Int String The main changes * The ExplicitList constructor of HsExpr gets witness field * Ditto ArithSeq constructor * Ditto the ListPat constructor of HsPat Everything else flows from this.
* Merge branch 'refs/heads/vect-avoid' into vect-avoid-mergeManuel M T Chakravarty2013-02-061-8/+4
|\ | | | | | | | | | | | | | | | | Conflicts: compiler/rename/RnSource.lhs compiler/simplCore/OccurAnal.lhs compiler/vectorise/Vectorise/Exp.hs NB: Merging instead of rebasing for a change. During rebase Git got confused due to the lack of the submodules in my quite old fork.