| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
All this Left/Right business was making my head spin, so I defined
data HsArg tm ty
= HsValArg tm -- Argument is an ordinary expression (f arg)
| HsTypeArg ty -- Argument is a visible type application (f @ty)
and used it. This is just simple refactor; no change in behaviour.
|
|
|
|
|
|
|
|
|
|
| |
These comments clarify the details of:
commit 0257dacf228024d0cc6ba247c707130637a25580
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Mon Aug 28 14:20:02 2017 +0100
Refactor bindHsQTyVars and friends
|
|
|
|
|
| |
I added these when investigating Trac #14163, but they'll be
useful anyway.
|
|
|
|
| |
I prematurely committed the D3892 before adding a Note. Fix this.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to try a crude comparison of the type themselves, but this is
essentially impossible in STG as we have discarded. both casts and type
applications, so types might look different but be the same. Now we
simply compare their runtime representations.
See #14120.
Reviewers: austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #14120
Differential Revision: https://phabricator.haskell.org/D3879
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The unariser ensures that we never use case binders that are void,
unboxed sums, or unboxed tuples. However, previously StgLint was
enforcing this invariant even before the unariser was running, giving
rise to spurious lint failures. Fix this. Following CoreLint, we
introduce a LintFlags environment to the linter monad, allowing for
additional flags to be easily accomodated in the future.
See #14118.
Test Plan: Build GHC with -dstg-lint
Reviewers: simonpj, austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #14118
Differential Revision: https://phabricator.haskell.org/D3889
|
|
|
|
|
|
|
|
| |
Reviewers: austin
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3887
|
|
|
|
|
|
|
|
|
|
|
| |
There were a couple places where we indexed into linked lists of
register names. Replace these with arrays.
Reviewers: austin
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3893
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Fix the path decomposition error that occurs when the Symlink resolver
fails. `Win32.try` throws an exception, so catch it and assume the path
isn't a symlink to use the old behavior.
Test Plan: ./validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #14159
Differential Revision: https://phabricator.haskell.org/D3891
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements @simonpj's suggested refactoring of the abstract syntax
for type/data family instances (from
https://ghc.haskell.org/trac/ghc/ticket/14131#comment:9). This combines
the previously separate `TyFamEqn` and `DataFamInstDecl` types into a
single `FamEqn` datatype. This also factors the `HsImplicitBndrs` out of
`HsTyPats` in favor of putting them just outside of `FamEqn` (as opposed
to before, where all of the implicit binders were embedded inside of
`TyFamEqn`/`DataFamInstDecl`). Finally, along the way I noticed that
`dfid_fvs` and `tfid_fvs` were completely unused, so I removed them.
Aside from some changes in parser test output, there is no change in
behavior.
Requires a Haddock submodule commit from my fork (at
https://github.com/RyanGlScott/haddock/commit/815d2deb9c0222c916becccf84
64b740c26255fd)
Test Plan: ./validate
Reviewers: simonpj, austin, goldfire, bgamari, alanz
Reviewed By: bgamari
Subscribers: mpickering, goldfire, rwbarton, thomie, simonpj
GHC Trac Issues: #14131
Differential Revision: https://phabricator.haskell.org/D3881
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes dll-split from the code base, the reason is dll-split
no longer makes any sense. It was designed to split a dll in two, but we
now already have many more symbols than would fit inside two dlls. So we
need a third one. This means there's no point in having to maintain this
list as it'll never work anyway and the solution isn't scalable.
Test Plan: ./validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, #ghc_windows_task_force
GHC Trac Issues: #5987
Differential Revision: https://phabricator.haskell.org/D3882
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider that we have two modules, A and B, both with hs-boot files,
* A.hs contains a SOURCE import of B
* B.hs-boot contains a SOURCE import of A
* A.hs-boot declares an orphan instance
* A.hs defines the orphan instance
In this case, B's dep_orphs will contain A due to its SOURCE import of
A. Consequently, A will contain itself in its imp_orphs due to its
import of B. This fact would end up being recorded in A's interface
file. This would then break the invariant asserted by calculateAvails
that a module does not itself in its dep_orphs. This was the cause
of #14128.
The solution is to remove self-references from imp_orphs when
constructing dep_orphs; we already did a similar thing for dep_mods. I
believe we should do the same for dep_finsts, although I'm treating this
as a separate bug.
Reviewers: austin
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3892
|
|
|
|
|
| |
typeKind can fail, and it's called all over the place, so
it's helpful to know where
|
|
|
|
|
|
|
|
|
| |
Instead of using a string argument, use HasDebugCallStack.
(Oddly, some functions were using both!)
Plus, use getRuntimeRep rather than getRuntimeRep_maybe when
if the caller panics on Nothing. Less code, and a better debug
stack.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In tcDataConPat we were creating an ill-kinded substitution
-- or at least one that is well kinded only after you have solved
other equalities. THat led to a crash, because the instantiated
data con type was ill-kinded.
This patch guarantees that the instantiating substitution is
well-kinded.
Fixed Trac #14154
|
|
|
|
| |
No change in behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This work was triggered by Trac #13738, which revealed to me that
the code RnTypes.bindHsQTyVars and bindLHsTyVarBndrs was a huge
tangled mess -- and outright wrong on occasion as the ticket showed.
The big problem was that bindLHsTyVarBndrs (which is invoked at every
HsForAll, including nested higher rank ones) was attempting to bind
implicit kind variables, which it has absolutely no busineess doing.
Imlicit kind quantification is done at the outside only, in fact
precisely where we have HsImplicitBndrs or LHsQTyVars (which also
has implicit binders).
Achieving this move was surprisingly hard, because more and more
barnacles had accreted aroud the original mistake. It's much
much better now.
Summary of changes. Almost all the action is in RnTypes.
* Implicit kind variables are bound only by
- By bindHsQTyVars, which deals with LHsQTyVars
- By rnImplicitBndrs, which deals with HsImplicitBndrs
* bindLHsTyVarBndrs, and bindLHsTyVarBndr are radically simplified.
They simply does far less, and have lots their forest of
incomprehensible accumulating parameters. (To be fair, some of
the code in bindLHsTyVarBndrs just moved to bindHsQTyVars, but
in much more perspicuous form.)
* The code that checks if a variable appears in both a kind and
a type (triggering RnTypes.mixedVarsErr) was bizarre. E.g.
we had this in RnTypes.extract_hs_tv_bndrs
; check_for_mixed_vars bndr_kvs acc_tvs
; check_for_mixed_vars bndr_kvs body_tvs
; check_for_mixed_vars body_tvs acc_kvs
; check_for_mixed_vars body_kvs acc_tvs
; check_for_mixed_vars locals body_kvs
I cleaned all this up; now we check for mixed use at binding
sites only.
* Checks for "Variable used as a kind before being bound", like
data T (a :: k) k = rhs
now just show up straightforwardly as "k is not in scope".
See Note [Kind variable ordering]
* There are some knock-on simplifications in RnSource.
|
|
|
|
|
|
|
|
| |
This usefully joins whenXOptM; there are probably lots of places
we should use it!
This patch does not use new new function at all; but it's preparing
for an upcoming patch when I do use it.
|
| |
|
|
|
|
|
|
| |
Anon and Required were printed the same :-(. This is only for
debug printing, so I switched to a slightly more verbose and
explicit format
|
|
|
|
| |
Better comment on con_qvars in ConDecl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, `showAstData` produced a `String`. That `String` would
then be converted to a `Doc` using `text` to implement
`-ddump-parsed-ast`. But rendering `text` calculates the length
of the `String` before doing anything else. Since the AST can be
very large, this was bad: the whole dump string (potentially hundreds
of millions of `Char`s) was accumulated in memory.
Now, `showAstData` produces a `Doc` directly, which seems to work
a lot better. As an extra bonus, the code is simpler and cleaner.
The formatting has changed a bit, as the previous ad hoc approach
didn't really match the pretty printer too well. If someone cares
enough to request adjustments, we can surely make them.
Reviewers: austin, bgamari, mpickering, alanz
Reviewed By: bgamari
Subscribers: mpickering, rwbarton, thomie
GHC Trac Issues: #14161
Differential Revision: https://phabricator.haskell.org/D3894
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr
Subscribers: rwbarton, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D3886
|
| |
|
|
|
|
|
|
| |
This minor change fixes Trac #14137.
It is described in Note [Join point RHSs] in OccurAnal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Triggered by #12150, and the knock-on effects of join points, I did a
major refactoring of the Simplifier. This is a big patch that change
a lot of Simplify.hs: I did a lot of other re-organisation.
The main event
~~~~~~~~~~~~~~
Since the dawn of time we have had
simplExpr :: SimplEnv -> InExpr -> SimplCont
-> SimplM (SimplEnv, OutExpr)
What's that SimplEnv in the result? When simplifying an expression the
simplifier add floated let-bindings to the SimplEnv, extending the
in-scope set appropriately, and hence needs to resturn the SimplEnv at
the end. The mode, flags, substitution in the returned SimplEnv were
all irrelevant: it was just the floating bindings.
It's strange to accumulate part of the /result/ in the /environment/
argument! And indeed its leads to all manner of mysterious calls to
zapFloats and transferring of floats from one SimplEnv to another.
It got worse with join points, so I finally bit the bullet and refactored.
Now we have
simplExpr :: SimplEnv -> InExpr -> SimplCont
-> SimplM (SimplFloats, OutExpr)
-- See Note [The big picture]
and the SimplEnv no longer has floats in it. The code is no shorter,
but it /is/ easier to understand.
Main changes
* Remove seLetFloats field from SimplEnv
* Define new data type SimplFloats, and functions over it
* Change the types of simplExpr, simplBind, and their many variants,
to follow the above plan
Bottoming bindings
~~~~~~~~~~~~~~~~~~
I made one other significant change in SimplUtils (not just refactoring),
related to Trac #12150 comment:16. Given
x = <rhs>
where <rhs> turns out to be a bottoming expression, propagate that
information to x's IdInfo immediately. That's always good, because
it makes x be inlined less (we don't inline bottoming things), and
it allows (case x of ...) to drop the dead alterantives immediately.
Moreover, we are doing the analysis anyway, in tryEtaExpandRhs, which
calls CoreArity.findRhsArity, which already does simple bottom analysis.
So we are generating the information; all we need do is to atach the
bottoming info to the IdInfo.
See Note [Bottoming bindings]
Smaller refactoring
~~~~~~~~~~~~~~~~~~~
* Rename SimplifierMode to SimplMode
* Put DynFlags as a new field in SimplMode, to make fewer
monadic calls to getDynFlags.
* Move the code in addPolyBind into abstractFloats
* Move the "don't eta-expand join points" into tryEtaExpandRhs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes isExpandableApp and isWorkFreeApp to respond
False to bottoming applications. I found that if we had
x = undefined <dict-expr>
then prepareRhs was ANF'ing it to
d = <dict-expr>
x = undefined d
which is stupid (no gain); and worse it made the simplifier iterate
indefinitely. It showed up when I started marking 'x' as a bottoming
Id more aggresssively than before; but it's been a lurking bug for
ages.
It was convenient to make isWorkFreeApp also return False for
bottoming applications, and I see no reason not to do so.
That leaves isCheapApp. It currently replies True to bottoming
applications, but I don't see why that's good.. Something to try
later.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider
case x of y
DEFAULT -> let v::Int# = case y of
True -> e1
False -> e2
in ...
Previously this would have been ok-for-speculation because
y is evaluated. But the binder-swap done
by SetLevels would transform the inner alternative to
DEFAULT -> let v::Int# = case x of { ... }
in ...)
which does /not/ satisfy the let/app invariant, because x is
not evaluated.
I don't know why this has never bitten us before, but it began
to bite when I did upcoming refactoring of the Simplifier.
So this patch narrows exprOkForSpeculation to only work for
/unlifted/ cases.
To make this work I had to make exprOkForSpeculation non-polymorphic
in the binder type, which has a little knock-on for is use in
SetLevels.
(It's annoying that we need to handle cases at all, but see
Note [exprOkForSpeculation: case expressions])
|
|
|
|
| |
Simple refactoring, reducing unncessary module loops
|
|
|
|
|
|
|
|
| |
In the hacky code in TcUnify.buildImplication we'd failed to account
for -fdefer-out-of-scope-variables. See the new function
TcUnify.implicationNeeded.
Fixes Trac #14149
|
|
|
|
| |
Debug-only; no change in mainstream behaviour
|
|
|
|
| |
and update to the 'nofib' submodule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously due to #12759 we disabled PIE support entirely. However, this
breaks the user's ability to produce PIEs. Add an explicit flag, -fPIE,
allowing the user to build PIEs.
Test Plan: Validate
Reviewers: rwbarton, austin, simonmar
Subscribers: trommler, simonmar, trofi, jrtc27, thomie
GHC Trac Issues: #12759, #13702
Differential Revision: https://phabricator.haskell.org/D3589
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #14142
Differential Revision: https://phabricator.haskell.org/D3876
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As described in `Note [CoreSyn let/app invariant]` this is allowed.
Fixes #14117.
Test Plan: Build GHC with BuildFlavour=devel2 with -dstg-lint
Reviewers: austin, simonpj
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #14117
Differential Revision: https://phabricator.haskell.org/D3857
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The parallel codepath was incorrectly retypechecking the
hs-boot ModIface prior to typechecking the hs file,
which was inconsistent with the non-parallel case. The
non-parallel case gets it right: you don't want to retypecheck
the hs-boot file itself (forwarding its declarations to hs)
because you need it to be consistently knot-tied with itself
when you compare the interfaces.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, simonpj, austin
Reviewed By: bgamari
Subscribers: duog, rwbarton, thomie
GHC Trac Issues: #14075
Differential Revision: https://phabricator.haskell.org/D3815
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Currently, whenever you apply a function to too many arguments and
some of those arguments happen to be visible type applications, the error
message that GHC gives is rather confusing. Consider the message you receive
when typechecking `id @Int 1 2`:
```
The function `id` is applied to three arguments,
but its type `Int -> Int` has only one
```
This is baffling, since the two lines treat the visible type argument `@Int`
differently. The top line ("applied to three arguments") includes `@Int`,
whereas the bottom line ("has only one") excludes `@Int` from consideration.
There are multiple ways one could fix this, which I explain in an addendum to
`Note [Herald for matchExpectedFunTys]`. The approach adopted here is to change
the herald of this error message to include visible type arguments, and to
avoid counting them in the "applied to n arguments" part of the error. The end
result is that the new error message for `id @Int 1 2` is now:
```
The expression `id @Int` is applied to two arguments,
but its type `Int -> Int` has only one
```
Test Plan: make test TEST=T13902
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie
GHC Trac Issues: #13902
Differential Revision: https://phabricator.haskell.org/D3868
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
When reifying GADTs with Template Haskell, the universally quantified
type variables were being reused across both the data type head and the
constructors' type signatures. This had the annoying effect of causing sets
of differently scoped variables to have the same uniques. To avoid this, we
now freshen the universal tyvars before reifying the constructors so as to
ensure they have distinct uniques.
Test Plan: make test TEST=T13885
Reviewers: goldfire, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #13885
Differential Revision: https://phabricator.haskell.org/D3867
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Because we weren't checking for duplicate variables on the right-hand
sides of pattern synonyms, bogus definitions like this one passed the renamer:
```lang=haskell
pattern Foo a <- (a,a)
```
Luckily, the fix is simple.
Test Plan: make test TEST=T14114
Reviewers: mpickering, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie
GHC Trac Issues: #14114
Differential Revision: https://phabricator.haskell.org/D3866
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Commit 3540d1e1a23926ce0a8a6ae83a36f5f6b2497ccf inadvertently broke
the ability for newtype instances to be used as marshallable types in FFI
declarations. The reason is a bit silly: an extra check was added for type
synonyms with no type families on the RHS in `normalise_tc_app`, but this check
would only skip over type families, not //data// families, since the predicate
being used was `not . isTypeFamilyCon`.
The fix is simple: just use `not . isFamilyCon` instead so that data families
are also skipped by this check.
Test Plan: make test TEST=T14125
Reviewers: goldfire, simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #14125
Differential Revision: https://phabricator.haskell.org/D3865
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes all dependencies the users guide had on `mkUserGuidePart`.
The generation of the flag reference table and the various pieces of the
man page is now entirely contained within the Spinx extension
`flags.py`. You can see the man page generation on the orphan page
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghc.html
The extension works by collecting all of the meta-data attached to the
`ghc-flag` directives and then formatting and displaying it at
`flag-print` directives. There is a single printing directive that can
be customized with two options, what format to display (table, list, or
block of flags) and an optional category to limit the output to
(verbosity, warnings, codegen, etc.).
New display formats can be added by creating a function
`generate_flag_xxx` (where `xxx` is a description of the format) which
takes a list of flags and a category and returns a new `xxx`. Then just
add a reference in the dispatch table `handlers`. That display can now
be run by passing `:type: xxx` to the `flag-print` directive.
`flags.py` contains two maps of settings that can be adjusted. The first
is a canonical list of flag categories, and the second sets default
categories for files.
The only functionality that Sphinx could not replace was the
`what_glasgow_exts_does.gen.rst` file. `mkUserGuidePart` actually just
reads the list of flags from `compiler/main/DynFlags.hs` which Sphinx
cannot do. As the flag is deprecated, I added the list as a static file
which can be updated manually.
Additionally, this patch updates every single documented flag with the
data from `mkUserGuidePart` to generate the reference table.
Fixes #11654 and, incidentally, #12155.
Reviewers: austin, bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #11654, #12155
Differential Revision: https://phabricator.haskell.org/D3839
|
| |
|
| |
|
|
|
|
|
|
| |
This patch makes the Lint warning about recursive functions with an
INLINE only apply if there is a stable unfolding. If not (e.g. some
other pass took it out) we don't need to worry. Not a big deal.
|
|
|
|
| |
Provoked by Trac #14052
|
|
|
|
|
| |
because this is a convenience function for API users, calculate the
in-scope set from `exprFreeVars`.
|
|
|
| |
This fixes #14105.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This ties up the last loose end in Template Haskell's separate
code paths for types and kinds. By making `reifyKind = reifyType` in
`TcSplice`, types and kinds are now treated on equal terms in TH.
This is itself a small patch, but most of the heavy lifting to make this
possible was done in ad7b945257ea262e3f6f46daa4ff3e451aeeae0b.
Test Plan: ./validate
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie
GHC Trac Issues: #11785
Differential Revision: https://phabricator.haskell.org/D3854
|