| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch implements Backpack for GHC. It's a big patch but I've tried quite
hard to keep things, by-in-large, self-contained.
The user facing specification for Backpack can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst
A guide to the implementation can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack-impl/proposals/0000-backpack-impl.rst
Has a submodule update for Cabal, as well as a submodule update
for filepath to handle more strict checking of cabal-version.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, simonmar, bgamari, goldfire
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1482
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allows users to explicitly request which approach to `deriving` to use
via keywords, e.g.,
```
newtype Foo = Foo Bar
deriving Eq
deriving stock Ord
deriving newtype Show
```
Fixes #10598. Updates haddock submodule.
Test Plan: ./validate
Reviewers: hvr, kosmikus, goldfire, alanz, bgamari, simonpj, austin,
erikd, simonmar
Reviewed By: alanz, bgamari, simonpj
Subscribers: thomie, mpickering, oerjan
Differential Revision: https://phabricator.haskell.org/D2280
GHC Trac Issues: #10598
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch we stop generating virtual semicolons in MultiWayIf
guards. Fixes #10807.
Test Plan:
Reviewers: simonmar, austin, bgamari
Reviewed By: simonmar
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2524
GHC Trac Issues: #10807
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch implements primitive unboxed sum types, as described in
https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes.
Main changes are:
- Add new syntax for unboxed sums types, terms and patterns. Hidden
behind `-XUnboxedSums`.
- Add unlifted unboxed sum type constructors and data constructors,
extend type and pattern checkers and desugarer.
- Add new RuntimeRep for unboxed sums.
- Extend unarise pass to translate unboxed sums to unboxed tuples right
before code generation.
- Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
code generation when sum values are involved.
- Add user manual section for unboxed sums.
Some other changes:
- Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
`MultiValAlt` to be able to use those with both sums and tuples.
- Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
wrong, given an `Any` `TyCon`, there's no way to tell what its kind
is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.
- Fix some bugs on the way: #12375.
Not included in this patch:
- Update Haddock for new the new unboxed sum syntax.
- `TemplateHaskell` support is left as future work.
For reviewers:
- Front-end code is mostly trivial and adapted from unboxed tuple code
for type checking, pattern checking, renaming, desugaring etc.
- Main translation routines are in `RepType` and `UnariseStg`.
Documentation in `UnariseStg` should be enough for understanding
what's going on.
Credits:
- Johan Tibell wrote the initial front-end and interface file
extensions.
- Simon Peyton Jones reviewed this patch many times, wrote some code,
and helped with debugging.
Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
simonmar, hvr, erikd
Reviewed By: simonpj
Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2259
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not having SCCs at the top level is becoming annoying real quick. For
simplest cases, it's possible to do this transformation:
f x y = ...
=>
f = {-# SCC f #-} \x y -> ...
However, it doesn't work when there's a `where` clause:
f x y = <t is in scope>
where t = ...
=>
f = {-# SCC f #-} \x y -> <t is out of scope>
where t = ...
Or when we have a "equation style" definition:
f (C1 ...) = ...
f (C2 ...) = ...
f (C3 ...) = ...
...
(usual solution is to rename `f` to `f'` and define a new `f` with a
`SCC`)
This patch implements support for SCC annotations in declaration
contexts. This is now a valid program:
f x y = ...
where
g z = ...
{-# SCC g #-}
{-# SCC f #-}
Test Plan: This passes slow validate (no new failures added).
Reviewers: goldfire, mpickering, austin, bgamari, simonmar
Reviewed By: bgamari, simonmar
Subscribers: simonmar, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2407
|
|
|
|
|
|
|
|
|
| |
This makes pattern synonym signatures more consistent with normal
type signatures.
Updates haddock submodule.
Differential Revision: https://phabricator.haskell.org/D2083
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
MatchFixity was introduced to facilitate use of API Annotations.
HsMatchContext does the same thing with more detail, but is chased
through all over the place to provide context when processing a Match.
Since we already have MatchFixity in the Match, it may as well provide
the full context.
updates submodule haddock
Test Plan: ./validate
Reviewers: austin, goldfire, bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2271
GHC Trac Issues: #12105
(cherry picked from commit 306ecad591951521ac3f5888ca8be85bf749d271)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Deriving `Typeable` has been a no-op since GHC 7.10, and now that we
require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable`
statements in GHC.
Test Plan: ./validate
Reviewers: goldfire, austin, hvr, bgamari
Reviewed By: austin, hvr, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2260
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've also added cases for `IToparenbar` and `ITcparenbar` (aka banana
brackets) to `isUnicode`.
Document unicode TH quote alternatives (#11743)
Test Plan: ./validate
Reviewers: austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2185
GHC Trac Issues: #11743
|
|
|
|
|
| |
A minor parser issue, allowing a mal-formed data constructor
through.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Split out the options needed by the parser from DynFlags, making the
parser more friendly to standalone usage.
Test Plan: validate
Reviewers: simonmar, alanz, bgamari, austin, thomie
Reviewed By: simonmar, alanz, bgamari, thomie
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2208
GHC Trac Issues: #10961
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, one can document top-level instance declarations, but derived
instances (both those in `deriving` clauses and standalone `deriving`
instances) do not enjoy the same privilege. This makes the necessary
changes to the parser to enable attaching Haddock comments for derived
instances.
Updates haddock submodule.
Fixes #11768.
Test Plan: ./validate
Reviewers: hvr, bgamari, austin
Reviewed By: austin
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2175
GHC Trac Issues: #11768
|
|
|
|
| |
This suggestion only applies to operators.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the long discussion on #11432, it was decided that when a type
constructor is parsed as a variable ((--.->) is one example) then in
order to export the type constructor then the user should be required to
use the ExplicitNamespaces keyword.
This was implemented in quite an indirect manner in the renamer. It
is much more direct to enforce this in the parser at the expense of
slighty worse error messages. Further to this, the check in the
renamer was actually slightly wrong. If the variable was in scope
then no error was raised, this was causing panics, see #12026 for an
example.
Reviewers: austin, bgamari
Subscribers: davean, skvadrik, thomie
Differential Revision: https://phabricator.haskell.org/D2181
GHC Trac Issues: #12026
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
With this patch closed variables are allowed regardless of whether
they are bound at the top level or not.
The FloatOut pass is always performed. When optimizations are
disabled, only expressions that go to the top level are floated.
Thus, the applications of the StaticPtr data constructor are always
floated.
The CoreTidy pass makes sure the floated applications appear in the
symbol table of object files. It also collects the floated bindings
and inserts them in the static pointer table.
The renamer does not check anymore if free variables appearing in the
static form are top-level. Instead, the typechecker looks at the
tct_closed flag to decide if the free variables are closed.
The linter checks that applications of StaticPtr only occur at the
top of top-level bindings after the FloatOut pass.
The field spInfoName of StaticPtrInfo has been removed. It used to
contain the name of the top-level binding that contains the StaticPtr
application. However, this information is no longer available when the
StaticPtr is constructed, as the binding name is determined now by the
FloatOut pass.
Test Plan: ./validate
Reviewers: goldfire, simonpj, austin, hvr, bgamari
Reviewed By: simonpj
Subscribers: thomie, mpickering, mboes
Differential Revision: https://phabricator.haskell.org/D2104
GHC Trac Issues: #11656
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This big patch is in pursuit of Trac #11348.
It is largely the work of Alex Veith (thank you!), with some
follow-up simplification and refactoring from Simon PJ.
The main payload is described in RnSource
Note [Dependency analysis of type, class, and instance decls]
which is pretty detailed.
* There is a new data type HsDecls.TyClGroup, for a strongly
connected component of type/class/instance/role decls.
The hs_instds field of HsGroup disappears, in consequence
This forces some knock-on changes, including a minor
haddock submodule update
Smaller, weakly-related things
* I found that both the renamer and typechecker were building an
identical env for RoleAnnots, so I put common code for
RoleAnnotEnv in RnEnv.
* I found that tcInstDecls1 had very clumsy error handling, so I
put it together into TcInstDcls.doClsInstErrorChecks
|
|
|
|
|
|
|
|
|
|
| |
* Move the several calls of tauifyMultipleMatches into tcMatches,
so that it can be called only once, and the invariants are
clearer
* I discovered in doing this that HsLamCase had a redundant and
tiresome argument, so I removed it. That in turn allowed some
modest but nice code simplification
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Add "⦇" and "⦈" as unicode alternatives for "(|" and "|)" respectively.
This must be implemented differently than other unicode additions
because ⦇" and "⦈" are interpretted as a $unigraphic rather than
a $unisymbol.
Test Plan: validate
Reviewers: goldfire, bgamari, austin
Reviewed By: bgamari, austin
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2012
GHC Trac Issues: #10162
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now check that a CUSK is really a CUSK and issue an error if
it isn't. This also involves more solving and zonking in
kcHsTyVarBndrs, which was the outright bug reported in #11648.
Test cases: polykinds/T11648{,b}
This updates the haddock submodule.
[skip ci]
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces the old HsType and HsTypeOut constructors
with HsAppType and HsAppTypeOut, leading to some simplification.
(This refactoring addresses #11329.)
This also fixes #11456, which stumbled over HsType (which is
not an expression).
test case: ghci/scripts/T11456
[skip ci]
|
|
|
|
|
|
|
| |
This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during lexing.
This implements another part of #10752
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Reviewed by: austin, rwbarton
Differential Revision: https://phabricator.haskell.org/D1938
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea here is described in [wiki:Typechecker]. Briefly,
this refactor keeps solid track of "synthesis" mode vs
"checking" in GHC's bidirectional type-checking algorithm.
When in synthesis mode, the expected type is just an IORef
to write to.
In addition, this patch does a significant reworking of
RebindableSyntax, allowing much more freedom in the types
of the rebindable operators. For example, we can now have
`negate :: Int -> Bool` and
`(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
is in tcSyntaxOp.
This addresses tickets #11397, #11452, and #11458.
Tests:
typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
th/T11452
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In the past the canonical way for constructing an SDoc string literal was the
composition `ptext . sLit`. But for some time now we have function `text` that
does the same. Plus it has some rules that optimize its runtime behaviour.
This patch takes all uses of `ptext . sLit` in the compiler and replaces them
with calls to `text`. The main benefits of this patch are clener (shorter) code
and less dependencies between module, because many modules now do not need to
import `FastString`. I don't expect any performance benefits - we mostly use
SDocs to report errors and it seems there is little to be gained here.
Test Plan: ./validate
Reviewers: bgamari, austin, goldfire, hvr, alanz
Subscribers: goldfire, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1784
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Certain syntactic elements have integers in them, such as fixity
specifications, SPECIALISE pragmas and so on.
The lexer will accept mult-radix literals, with arbitrary leading zeros
in these.
Bring in a SourceText field to each affected AST element to capture the
original literal text for use with API Annotations.
Affected hsSyn elements are
```
-- See note [Pragma source text]
data Activation = NeverActive
| AlwaysActive
| ActiveBefore SourceText PhaseNum
-- Active only *strictly before* this phase
| ActiveAfter SourceText PhaseNum
-- Active in this phase and later
deriving( Eq, Data, Typeable )
-- Eq used in comparing rules in HsDecls
data Fixity = Fixity SourceText Int FixityDirection
-- Note [Pragma source text]
deriving (Data, Typeable)
```
and
```
| HsTickPragma -- A pragma introduced tick
SourceText -- Note [Pragma source text] in BasicTypes
(StringLiteral,(Int,Int),(Int,Int))
-- external span for this tick
((SourceText,SourceText),(SourceText,SourceText))
-- Source text for the four integers used in the span.
-- See note [Pragma source text] in BasicTypes
(LHsExpr id)
```
Updates haddock submodule
Test Plan: ./validate
Reviewers: goldfire, bgamari, austin
Reviewed By: bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1781
GHC Trac Issues: #11430
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
But still disallow empty pattern synonym builder declarations. Handling
this incorrectly was the cause of #11367.
Test Plan: ./validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1779
GHC Trac Issues: #11367
|
|
|
|
|
|
|
|
|
| |
Previously oqtycon used AnnTilde for the location of the RdrName when
parsing (~).
The recent increase in '~' characters in the AST confuses
ghc-exactprint, so this patch treats all RdrNames the same way now,
marking the location of the core name with AnnValue.
|
|
|
|
|
|
|
|
|
|
|
| |
Rule numbers tend to go out-of-date, and aren't useful.
And during validate, the actual number of shift/reduce
conflicts is now checked against the number stated in Parser.y.
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D1754
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
For the following code fragment
{-# LANGUAGE PatternSynonyms #-}
module ExportSyntax ( A(.., NoA), Q(F,..), G(T,..,U)) where
The second and third .. are missing AnnDotdot annotations.
Closes #11332
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In T10689a.hs, the fragment
data instance Sing (z :: [a])
= z ~ '[] =>
SNil
| forall (m :: a)
(n :: [a]). z ~ (:) m n =>
SCons (Sing m) (Sing n)
ends up with the AnnTilde annotations for the two tildes not attached to
the final AST.
This patch moves the AnnTilde to the right place.
Closes #11321
|
|
|
|
|
|
| |
Starting with GHC 7.10 and base-4.8, `Monad` implies `Applicative`,
which allows to simplify some definitions to exploit the superclass
relationship. This a first refactoring to that end.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since GHC 8.1/8.2 only needs to be bootstrap-able by GHC 7.10 and
GHC 8.0 (and GHC 8.2), we can now finally drop all that pre-AMP
compatibility CPP-mess for good!
Reviewers: austin, goldfire, bgamari
Subscribers: goldfire, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1724
|
|
|
|
|
|
| |
- Export unicodeAnn from GHC
- unicodeAnn for Annlarrowtail was wrong
- Use actual source for a CImport SourceText
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This re-working of the typechecker algorithm is based on
the paper "Visible type application", by Richard Eisenberg,
Stephanie Weirich, and Hamidhasan Ahmed, to be published at
ESOP'16.
This patch introduces -XTypeApplications, which allows users
to say, for example `id @Int`, which has type `Int -> Int`. See
the changes to the user manual for details.
This patch addresses tickets #10619, #5296, #10589.
|
|
|
|
|
| |
A PatBind operates similarly to a FunBind, and so the RdrName and
infix/prefix state needs to be captured for use in API Annotations.
|
| |
|
|
|
|
|
| |
The list is reversed when it is used, so the comma must be added to the
item at the front of it, to be following it when used.
|
|
|
|
|
|
|
|
| |
The injectivity_cond production in Parser.y returns the annotation for
the '->' to the calling production, rather than applying it directly.
Rather apply it directly, so LInjectivityAnn can be rendered as a unit
from the API Annotations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various tickets have revealed bad shortcomings in the typechecking of
pattern type synonyms. Discussed a lot in (the latter part of)
Trac #11224.
This patch fixes the most complex issues:
- Both parser and renamer now treat pattern synonyms as an
ordinary LHsSigType. Nothing special. Hooray.
- tcPatSynSig (now in TcPatSyn) typechecks the signature, and
decomposes it into its pieces.
See Note [Pattern synonym signatures]
- tcCheckPatSyn has had a lot of refactoring.
See Note [Checking against a pattern signature]
The result is a lot tidier and more comprehensible.
Plus, it actually works!
NB: this patch doesn't actually address the precise
target of #11224, namely "inlining pattern synonym
does not preserve semantics". That's an unrelated
bug, with a separate patch.
ToDo: better documentation in the user manual
Test Plan: Validate
Reviewers: austin, hvr, goldfire
Subscribers: goldfire, mpickering, thomie, simonpj
Differential Revision: https://phabricator.haskell.org/D1685
GHC Trac Issues: #11224
|
|
|
|
|
|
|
|
| |
splitTildeApps can introduce a new HsAppInfix for a tilde, with a fresh
SrcSpan, disconnecting its existing AnnTilde API Annotation.
A tilde needs AnnTilde to render properly, this patch adds a new one on
the fresh SrcSpan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An HsAppInfix can carry a qconop/varop preceded by a SIMPLEQUOTE as a
Located RdrName.
In this case AnnSimpleQuote is attached to the Located HsAppType.
| SIMPLEQUOTE qconop {% ams (sLL $1 $> $ HsAppInfix $2)
[mj AnnSimpleQuote $1] }
| SIMPLEQUOTE varop {% ams (sLL $1 $> $ HsAppInfix $2)
[mj AnnSimpleQuote $1] }
This patch changes
data HsType name
...
| HsAppsTy [HsAppType name]
to
data HsType name
...
| HsAppsTy [LHsAppType name]
so that the annotation is not discarded when it reaches the ParsedSource
|