summaryrefslogtreecommitdiff
path: root/compiler/rename
Commit message (Collapse)AuthorAgeFilesLines
...
* A bit of refactoring RnSpliceSimon Peyton Jones2015-05-071-6/+12
| | | | | ...to make clearer what the cross-stage lifting code applies to (c.f. Trac #10384)
* Revert "API Annotations : add Locations in hsSyn were layout occurs"Austin Seipp2015-05-063-35/+35
| | | | | | | This reverts commit fb54b2c11cc7f2cfbafa35b6a1819d7443aa5494. As Alan pointed out, this will make cherry picking a lot harder until 7.10.2, so lets back it out until after the release.
* API Annotations : add Locations in hsSyn were layout occursAlan Zimmerman2015-05-063-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment ghc-exactprint, which uses the GHC API Annotations to provide a framework for roundtripping Haskell source code with optional AST edits, has to implement a horrible workaround to manage the points where layout needs to be captured. These are MatchGroup HsDo HsCmdDo HsLet LetStmt HsCmdLet GRHSs To provide a more natural representation, the contents subject to layout rules need to be wrapped in a SrcSpan. This commit does this. Trac ticket #10250 Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D815 GHC Trac Issues: #10250
* Doc: checkCrossStageLifting, RnSplice/TcExpr is untyped/typed brackets (#10384)Edward Z. Yang2015-05-051-0/+3
| | | | | | | Clarify that repeated checkCrossStageLifting in RnSplice/TcExpr check untyped/typed brackets, respectively. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Permit empty closed type familiesAdam Gundry2015-05-041-2/+4
| | | | | | | | | | | | | | | | | | | Fixes #9840 and #10306, and includes an alternative resolution to #8028. This permits empty closed type families, and documents them in the user guide. It updates the Haddock submodule to support the API change. Test Plan: Added `indexed-types/should_compile/T9840` and updated `indexed-types/should_fail/ClosedFam4` and `th/T8028`. Reviewers: austin, simonpj, goldfire Reviewed By: goldfire Subscribers: bgamari, jstolarek, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D841 GHC Trac Issues: #9840, #10306
* Typo fixes (mostly in comments)Gabor Greif2015-04-303-3/+3
|
* Rename role annotations w.r.t only local decls.Richard Eisenberg2015-04-242-9/+25
| | | | Fix #10263.
* Fix #10182 by disallowing/avoiding self {-# SOURCE #-} importsEdward Z. Yang2015-04-221-4/+10
| | | | | | | | | | | | | | | | | | | | | Summary: hs-boot declarations were leaking into the EPS due to self {-# SOURCE #-} imports, and interface loading induced by orphan instances. For the former, we simply disallow self {-# SOURCE #-} imports; for the latter, we simply just don't load an interface if it would be ourself. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D860 GHC Trac Issues: #10182
* Documentation for rnImports/rnImportDecl.Edward Z. Yang2015-04-171-3/+19
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: comments only Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D816
* Refactor the extra-deps stuff for hs-bootSimon Peyton Jones2015-03-172-29/+40
| | | | | | See Note [Extra dependencies from .hs-boot files] in RnSource No change in behaviour
* driver: split -fwarn-unused-binds into 3 flags (fixes #17)Oleg Grenrus2015-02-232-3/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: New flags: -fwarn-unused-top-binds -fwarn-unused-local-binds -fwarn-unused-pattern-binds Test Plan: `tests/rename/should_compile/T17` tests Correct other tests Reviewers: austin, rwbarton Reviewed By: austin, rwbarton Subscribers: rwbarton, carter, thomie Differential Revision: https://phabricator.haskell.org/D591 GHC Trac Issues: #17
* nameIsLocalOrFrom should include interactive modulesSimon Peyton Jones2015-02-111-3/+3
| | | | | | | | | The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom should really include all interactive modules (ones from the 'interactive' package). Previously we had some ad-hoc 'isInteractiveModule' tests with some (but not all) the calls to nameIsLocalOrFrom. See the new comments with Name.nameIsLocalOrFrom.
* Refactor the handling of quasi-quotesSimon Peyton Jones2015-02-105-189/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed to behave exactly like $(n "...blah..."). But it doesn't! This was outright wrong: quasiquotes were being run even inside brackets. Now that TH supports both typed and untyped splices, a quasi-quote is properly regarded as a particular syntax for an untyped splice. But apart from that they should be treated the same. So this patch refactors the handling of quasiquotes to do just that. The changes touch quite a lot of files, but mostly in a routine way. The biggest changes by far are in RnSplice, and more minor changes in TcSplice. These are the places where there was real work to be done. Everything else is routine knock-on changes. * No more QuasiQuote forms in declarations, expressions, types, etc. So we get rid of these data constructors * HsBinds.QuasiQuoteD * HsExpr.HsSpliceE * HsPat.QuasiQuotePat * HsType.HsQuasiQuoteTy * We get rid of the HsQuasiQuote type altogether * Instead, we augment the HsExpr.HsSplice type to have three consructors, for the three types of splice: * HsTypedSplice * HsUntypedSplice * HsQuasiQuote There are some related changes in the data types in HsExpr near HsSplice. Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour. * In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one. A smaller, clearer interface. * We have to update the Haddock submodule, to accommodate the hsSyn changes
* Replace .lhs with .hs in compiler commentsYuri de Wit2015-02-093-4/+4
| | | | | | | | | | | | | | Summary: It looks like during .lhs -> .hs switch the comments were not updated. So doing exactly that. Reviewers: austin, jstolarek, hvr, goldfire Reviewed By: austin, jstolarek Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D621 GHC Trac Issues: #9986
* Fix Trac #10004: head [] exception when using recursive mdoSimon Peyton Jones2015-02-061-24/+29
|
* Comments onlySimon Peyton Jones2015-02-061-1/+1
|
* Bring Match m_fun_id_infix through the renamer.Alan Zimmerman2015-02-051-3/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a first step for #9988 It turns out that bringing m_fun_id_infix through the renamer is actually very simple, affecting the internals of rnMatch' only. Is this simple enough to hit 7.10.1? Test Plan: ./validate Reviewers: hvr, simonpj, austin Reviewed By: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D639 GHC Trac Issues: #9988
* Cosmetic: Fix all uses of the word 'worker' when referring to pattern ↵Dr. ERDI Gergo2015-01-201-6/+6
| | | | synonym builders
* API Annotations tweaks.Alan Zimmerman2015-01-166-71/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: HsTyLit now has SourceText Update documentation of HsSyn to reflect which annotations are attached to which element. Ensure that the parser always keeps HsSCC and HsTickPragma values, to be ignored in the desugar phase if not needed Bringing in SourceText for pragmas Add Location in NPlusKPat Add Location in FunDep Make RecCon payload Located Explicitly add AnnVal to RdrName where it is compound Add Location in IPBind Add Location to name in IEThingAbs Add Maybe (Located id,Bool) to Match to track fun_id,infix This includes converting Match into a record and adding a note about why the fun_id needs to be replicated in the Match. Add Location in KindedTyVar Sort out semi-colons for parsing - import statements - stmts - decls - decls_cls - decls_inst This updates the haddock submodule. Test Plan: ./validate Reviewers: hvr, austin, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D538
* Trac #9878: Make the static form illegal in interpreted mode.Alexander Vershilov2015-01-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The entries of the static pointers table are expected to exist as object code. Thus we have ghci complain with an intelligible error message if the static form is used in interpreted mode. It also includes a fix to keysHashTable in Hash.c which could cause a crash. The iteration of the hashtable internals was incorrect. This patch has the function keysHashTable imitate the iteration in freeHashTable. Finally, we submit here some minor edits to comments and GHC.StaticPtr.StaticPtrInfo field names. Authored-by: Alexander Vershilov <alexander.vershilov@tweag. Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io> Test Plan: ./validate Reviewers: simonpj, hvr, austin Reviewed By: austin Subscribers: carter, thomie, qnikst, mboes Differential Revision: https://phabricator.haskell.org/D586 GHC Trac Issues: #9878
* Repsect the package name when checking for self-importSimon Peyton Jones2015-01-161-1/+9
| | | | | | | | Fixes Trac #9997. In doing this I tripped across the specialness of "this" in PackageImports. The magic constant (fsLit "this") is scattered across the compiler and ought to be put in one place. But where?
* add -th-file which generates a th.hs fileGreg Weber2015-01-131-8/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: see Trac #8624 similar functionality is now available with -ddump-to-file -ddump-splices However, users are already accustomed to -ddump-splices having a particular format, and this format is not completely valid code The goal of -th-file is to dump valid Haskell code Additionally, the convention of -ddump-to-file is to name the file after the flag, so the file is .dump-splices Given that the goal of the new flag is to generate valid Haskell, The extension should be .hs Additionally, -ddump-to-file effects all other dump flags Test Plan: look at the output of using the -th-file flag and compare it to the output of using -ddump-to-file and -ddump-splices I want to add test cases, but just need some pointers on getting started there Reviewers: thomie, goldfire, simonpj, austin Reviewed By: simonpj, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D518 GHC Trac Issues: #8624
* Pattern synonym names need to be in scope before renaming bindings (#9889)Dr. ERDI Gergo2015-01-095-36/+64
| | | | I did a bit of refactoring at the same time, needless to say
* Spelling error in commentSimon Peyton Jones2015-01-081-1/+1
|
* Test earlier for self-import (Trac #9032)Simon Peyton Jones2014-12-231-3/+11
| | | | | | | | | This patch makes the renamer check for self-import, especially when dependencies change, because the typechecker can fall over if that happens. I'm still uneasy about *indirect* self-import, but I'll leave that for another day
* Add a small commentSimon Peyton Jones2014-12-231-1/+1
|
* Groom comments related to StaticPointers.Facundo Domínguez2014-12-221-1/+1
| | | | | | Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D575
* For :info, return all matching Names, rather than complaining about ambiguitySimon Peyton Jones2014-12-221-27/+54
| | | | | This fixes Trac #9881, and gives more helpful output in the case of ambiguity. Certainly more helpful than the positively-misleading error we get right now.
* Implement -XStaticValuesFacundo Domínguez2014-12-091-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As proposed in [1], this extension introduces a new syntactic form `static e`, where `e :: a` can be any closed expression. The static form produces a value of type `StaticPtr a`, which works as a reference that programs can "dereference" to get the value of `e` back. References are like `Ptr`s, except that they are stable across invocations of a program. The relevant wiki pages are [2, 3], which describe the motivation/ideas and implementation plan respectively. [1] Jeff Epstein, Andrew P. Black, and Simon Peyton-Jones. Towards Haskell in the cloud. SIGPLAN Not., 46(12):118–129, September 2011. ISSN 0362-1340. [2] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers [3] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers/ImplementationPlan Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io> Authored-by: Mathieu Boespflug <m@tweag.io> Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io> Test Plan: `./validate` Reviewers: hvr, simonmar, simonpj, austin Reviewed By: simonpj, austin Subscribers: qnikst, bgamari, mboes, carter, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D550 GHC Trac Issues: #7015
* renamer: fix trac issue #9778Carlos Tomé2014-12-051-1/+11
| | | | | | | | | | | | | | | | Summary: Added flag -fwarn-unticked-promoted-constructors Test Plan: test T9778 under tests/rename/should_compile Reviewers: jstolarek, simonpj, austin Reviewed By: jstolarek, simonpj, austin Subscribers: simonpj, goldfire, jstolarek, thomie, carter Differential Revision: https://phabricator.haskell.org/D534 GHC Trac Issues: #9778
* compiler: de-lhs rename/Austin Seipp2014-12-0310-597/+520
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Remove references to Parser.y.ppThomas Miedema2014-12-011-2/+2
| | | | | | | | | | | | | | Summary: Commit 37d64a51348a803a1cf974d9e97ec9231215064a removed the preprocessing step for Parser.y. Reviewers: rodlogic, austin Reviewed By: austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D543
* Implement Partial Type SignaturesThomas Winant2014-11-285-32/+116
| | | | | | | | | | | | | | | | | | | | Summary: Add support for Partial Type Signatures, i.e. holes in types, see: https://ghc.haskell.org/trac/ghc/wiki/PartialTypeSignatures This requires an update to the Haddock submodule. Test Plan: validate Reviewers: austin, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie, Iceland_jack, dominique.devriese, simonmar, carter, goldfire Differential Revision: https://phabricator.haskell.org/D168 GHC Trac Issues: #9478
* Rename some of the functions in NameSet, to make the uniform with VarSet etcSimon Peyton Jones2014-11-284-22/+22
| | | | | | | | | | | | | For ages NameSet has used different names, eg. addOneToNameSet rather than extendNameSet nameSetToList rather than nameSetElems etc. Other set-like modules use uniform naming conventions. This patch makes NameSet follow suit. No change in behaviour; this is just renaming. I'm doing this just before the fork so that merging is easier.
* Kind variables in RHS of an associated type instances should be bound on LHSSimon Peyton Jones2014-11-282-37/+41
| | | | | | | | | | | | | | | | | | | | | | | This patche fixes Trac #9574. The previous Note [Renaming associated types] in RnTypes appears to me to be wrong; it confused class and instance declarations. I have: * Treated kind and type variables uniformly. Both must be bound on the LHS of an associated type instance. Eg instance C ('KProxy :: KProxy o) where type F 'KProxy = NatTr (Proxy :: o -> *) is illegal because 'o' is not bound on the LHS of the instance. * Moved the Note to RnSource and fixed it up This improves the error message from T7938. However it made the code in T6118 incorrect. We had: instance SingE (a :: Maybe k) where type Demote a = Maybe (Demote (Any :: k)) and that is now rejected, rightly I think.
* compiler: add new modules pulling in FunFlagsSergei Trofimovich2014-11-271-1/+1
| | | | | | | | And also sync type signature under '#ifndef GHCI' Tested by setting GhcWithInterpreter = NO Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Change loadSrcInterface to return a list of ModIfaceEdward Z. Yang2014-11-262-31/+50
| | | | | | | | | | | | | | | | | | | | Summary: This change is in preparation to support signature imports, which may pull in multiple interface files. At the moment, the list always contains only one element, but in a later patch it may contain more. I also adjusted some error reporting code so that it didn't take the full iface, but just whether or not the iface in question was a boot module. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D436
* Add -fdefer-typed-holes flag which defers hole errors to runtime.Merijn Verstraaten2014-11-211-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As proposed by Richard on Trac. This patch adds a new flag -fdefer-typed-holes and changes the semantics of the -fno-warn-typed-holes flag. To summarise, by default GHC has typed holes enabled and produces a compile error when it encounters a typed hole. When -fdefer-type-errors OR -fdefer-typed-holes is enabled, hole errors are converted to warnings and result in runtime errors when evaluated. The warning flag -fwarn-typed-holes is on by default. Without -fdefer-type-errors or -fdefer-typed-holes this flag is a no-op, since typed holes are an error under these conditions. If either of the defer flags are enabled (converting typed hole errors into warnings) the -fno-warn-typed-holes flag disables the warnings. This means compilation silently succeeds and evaluating a hole will produce a runtime error. The rationale behind allowing typed holes warnings to be silenced is that tools like Syntastic for vim highlight warnings and hole warnings may be undesirable. Signed-off-by: Merijn Verstraaten <merijn@inconsistent.nl> Test Plan: validate Reviewers: austin, simonpj, thomie Reviewed By: simonpj, thomie Subscribers: Fuuzetsu, thomie, carter Differential Revision: https://phabricator.haskell.org/D442 GHC Trac Issues: #9497 Conflicts: compiler/main/DynFlags.hs
* Capture original source for literalsAlan Zimmerman2014-11-212-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make HsLit and OverLitVal have original source strings, for source to source conversions using the GHC API This is part of the ongoing AST Annotations work, as captured in https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations and https://ghc.haskell.org/trac/ghc/ticket/9628#comment:28 The motivations for the literals is as follows ```lang=haskell x,y :: Int x = 0003 y = 0x04 s :: String s = "\x20" c :: Char c = '\x20' d :: Double d = 0.00 blah = x where charH = '\x41'# intH = 0004# wordH = 005## floatH = 3.20# doubleH = 04.16## x = 1 ``` Test Plan: ./sh validate Reviewers: simonpj, austin Reviewed By: simonpj, austin Subscribers: thomie, goldfire, carter, simonmar Differential Revision: https://phabricator.haskell.org/D412 GHC Trac Issues: #9628
* AST changes to prepare for API annotations, for #9628Alan Zimmerman2014-11-217-165/+186
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: AST changes to prepare for API annotations Add locations to parts of the AST so that API annotations can then be added. The outline of the whole process is captured here https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations This change updates the haddock submodule. Test Plan: sh ./validate Reviewers: austin, simonpj, Mikolaj Reviewed By: simonpj, Mikolaj Subscribers: thomie, goldfire, carter Differential Revision: https://phabricator.haskell.org/D426 GHC Trac Issues: #9628
* Fix #9824 by not warning about unused matches in pattern quotes.Richard Eisenberg2014-11-211-0/+3
|
* Fix #1476 by making splice patterns work.Richard Eisenberg2014-11-213-12/+39
| | | | | | | | | Unfortunately, splice patterns in brackets still do not work because we don't run splices in brackets. Without running a pattern splice, we can't know what variables it binds, so we're stuck. This is still a substantial improvement, and it may be the best we can do. Still must document new behavior.
* Fix Trac #9815Simon Peyton Jones2014-11-211-4/+10
| | | | | | | | | | | Dot-dot record-wildcard notation is simply illegal for constructors without any named fields, but that was neither documented nor checked. This patch does so - Make the check in RnPat - Add test T9815 - Fix CmmLayoutStack which was using the illegal form (!) - Document in user manual
* Comments onlySimon Peyton Jones2014-11-211-1/+0
|
* Add support for pattern synonym type signatures.Dr. ERDI Gergo2014-11-201-18/+24
| | | | | | | | | | | | Syntax is of the form pattern P :: (Prov b) => (Req a) => a -> b -> Int -> T a which declares a pattern synonym called `P`, with argument types `a`, `b`, and `Int`, and result type `T a`, with provided context `(Prov b)` and required context `(Req a)`. The Haddock submodule is also updated to use this new syntax in generated docs.
* Fix #9066.Richard Eisenberg2014-11-121-21/+36
| | | | | | | | | | When splicing in a fixity declaration, look for both term-level things and type-level things. This requires some changes elsewhere in the code to allow for more flexibility when looking up Exact names, which can be assigned the wrong namespace during fixity declaration conversion. See the ticket for more info.
* Move expansion of 'assert' from renamer to typecheckerSimon Peyton Jones2014-11-061-37/+1
| | | | | This improves error messages when there is a type error, fixing Trac #9774
* A little refactoring of HsSplice and friendsSimon Peyton Jones2014-11-041-26/+27
| | | | | | | Plus adding comments. The most substantive change is that PendingTcSplice becomes a proper data type rather than a pair; and PendingRnSplice uses it
* Tweak the error message for pattern synonym methods,Dr. ERDI Gergo2014-11-021-1/+1
| | | | since they are disallowed both in class and instance declarations
* Bring unbound tyvars into scope during reifyInstances.Richard Eisenberg2014-11-011-0/+7
| | | | Fix #9262.