| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Note [Nullary unboxed tuple] was removed in e9e61f18a548b70693f4.
This codepath is tested by T15696_3.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit ef0135934fe32da5b5bb730dbce74262e23e72e8.
See ticket #21229
-------------------------
Metric Decrease:
T15164
Metric Increase:
T13056
-------------------------
|
|
|
|
|
| |
Replaces uses of `TcRnUnknownMessage` with proper diagnostics
constructors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, whenever `mkFunCo` would produce reflexive coercions, it would
use `mkVisFunTy` to produce the kind of the coercion. However, `mkFunCo` is
also used to produce coercions between types of the form `ty1 => ty2` in
certain places. This has the unfortunate side effect of causing the type of
the coercion to appear as `ty1 -> ty2` in certain error messages, as spotted
in #21328.
This patch address this by changing replacing the use of `mkVisFunTy` with
`mkFunctionType` in `mkFunCo`. `mkFunctionType` checks the kind of `ty1` and
makes the function arrow `=>` instead of `->` if `ty1` has kind `Constraint`,
so this should always produce the correct `AnonArgFlag`. As a result, this
patch fixes part (2) of #21328.
This is not the only possible way to fix #21328, as the discussion on that
issue lists some possible alternatives. Ultimately, it was concluded that the
alternatives would be difficult to maintain, and since we already use
`mkFunctionType` in `coercionLKind` and `coercionRKind`, using `mkFunctionType`
in `mkFunCo` is consistent with this choice. Moreover, using `mkFunctionType`
does not regress the performance of any test case we have in GHC's test suite.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes the unification of concrete type variables.
The subtlety was that unifying concrete metavariables is more subtle
than other metavariables, as decomposition is possible. See the Note
[Unifying concrete metavariables], which explains how we unify a
concrete type variable with a type 'ty' by concretising 'ty', using
the function 'GHC.Tc.Utils.Concrete.concretise'.
This can be used to perform an eager syntactic check for concreteness,
allowing us to remove the IsRefl# special predicate. Instead of emitting
two constraints `rr ~# concrete_tv` and `IsRefl# rr concrete_tv`, we
instead concretise 'rr'. If this succeeds we can fill 'concrete_tv',
and otherwise we directly emit an error message to the typechecker
environment instead of deferring. We still need the error message
to be passed on (instead of directly thrown), as we might benefit from
further unification in which case we will need to zonk the stored types.
To achieve this, we change the 'wc_holes' field of 'WantedConstraints'
to 'wc_errors', which stores general delayed errors. For the moement,
a delayed error is either a hole, or a syntactic equality error.
hasFixedRuntimeRep_MustBeRefl is now hasFixedRuntimeRep_syntactic, and
hasFixedRuntimeRep has been refactored to directly return the most
useful coercion for PHASE 2 of FixedRuntimeRep.
This patch also adds a field ir_frr to the InferResult datatype,
holding a value of type Maybe FRROrigin. When this value is not
Nothing, this means that we must fill the ir_ref field with a type
which has a fixed RuntimeRep.
When it comes time to fill such an ExpType, we ensure that the type
has a fixed RuntimeRep by performing a representation-polymorphism
check with the given FRROrigin
This is similar to what we already do to ensure we fill an Infer
ExpType with a type of the correct TcLevel.
This allows us to properly perform representation-polymorphism checks
on 'Infer' 'ExpTypes'.
The fillInferResult function had to be moved to GHC.Tc.Utils.Unify
to avoid a cyclic import now that it calls hasFixedRuntimeRep.
This patch also changes the code in matchExpectedFunTys to make use
of the coercions, which is now possible thanks to the previous change.
This implements PHASE 2 of FixedRuntimeRep in some situations.
For example, the test cases T13105 and T17536b are now both accepted.
Fixes #21239 and #21325
-------------------------
Metric Decrease:
T18223
T5631
-------------------------
|
| |
|
|
|
|
| |
This distills the essence of the Sigs.hs program found in the ticket.
|
|
|
|
|
|
|
| |
This module exports unsafe pointer equality operations,
so we accordingly mark it as Unsafe.
Fixes #21433
|
|
|
|
|
|
|
| |
This fixes the initialisation functions when using -prof or
-finfo-table-map.
Fixes #21370
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we deprecate the eventlogging RTS ways and instead enable eventlog
support in the remaining ways. This simplifies packaging and reduces GHC
compilation times (as we can eliminate two whole compilations of the RTS)
while simplifying the end-user story. The trade-off is a small increase
in binary sizes in the case that the user does not want eventlogging
support, but we think that this is a fine trade-off.
This also revealed a latent RTS bug: some files which included `Cmm.h`
also assumed that it defined various macros which were in fact defined
by `Config.h`, which `Cmm.h` did not include. Fixing this in turn
revealed that `StgMiscClosures.cmm` failed to import various spinlock
statistics counters, as evidenced by the failed unregisterised build.
Closes #18948.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We should only accept the type `Any` in foreign import/export
declarations when it has type `Type` or `UnliftedType`.
This patch adds a kind check, and a special error message triggered by
occurrences of `Any` in foreign import/export declarations at other
kinds.
Fixes #21305
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Second fix to #21391. It turned out that we missed calling
bringFloatedDictsIntoScope when specialising imports, which
led to the same bug as before.
I refactored to move that call to a single place, in specCalls,
so we can't forget it.
This meant making `FloatedDictBinds` into its own type, pairing
the dictionary bindings themselves with the set of their binders.
Nicer this way.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "candidates" passed to decideMonoTyVars can contain coercion holes.
This is because we might well decide to quantify over some unsolved
equality constraints, as long as they are not definitely insoluble.
In that situation, decideMonoTyVars was passing a set of type variables
that was not closed over kinds to closeWrtFunDeps, which was tripping
up an assertion failure.
Fixes #21404
|
|
|
|
|
|
| |
This can be disabled by `-fno-dump-with-ways` if not desired.
Finally we will be able to look at both profiled and non-profiled dumps
when compiling with dump flags and we compile in both ways.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In GHC.Core.Opt.Specialise.bindAuxiliaryDict we were unnecessarily
calling `extendInScope` to bring into scope variables that were
/already/ in scope. Worse, GHC.Core.Subst.extendInScope strangely
deleted the newly-in-scope variables from the substitution -- and that
was fatal in #21391.
I removed the redundant calls to extendInScope.
More ambitiously, I changed GHC.Core.Subst.extendInScope (and cousins)
to stop deleting variables from the substitution. I even changed the
names of the function to extendSubstInScope (and cousins) and audited
all the calls to check that deleting from the substitution was wrong.
In fact there are very few such calls, and they are all about
introducing a fresh non-in-scope variable. These are "OutIds"; it is
utterly wrong to mess with the "InId" substitution.
I have not added a Note, because I'm deleting wrong code, and it'd be
distracting to document a bug.
|
|
|
|
|
|
|
|
|
| |
This provides a way to set the Opt_KeepRawTokenStream from the command
line, allowing exact print annotation users to see exactly what is
produced for a given parsed file, when used in conjunction with
-ddump-parsed-ast
Discussed in #19706, but this commit does not close the issue.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This will mean T9208 when run with lint will return a lint error instead
of resulting in a panic.
Fixes #21117
|
|
|
|
|
|
|
|
| |
This change makes it clear that it's the definition rather than any
usage which is a problem, and that rules defined in other modules will
still be used to do rewrites.
Fixes #20923
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In #19644, we discovered that the ClassOp/DFun rules from
Note [ClassOp/DFun selection] inhibit transitive specialisation in a scenario
like
```
class C a where m :: Show b => a -> b -> ...; n :: ...
instance C Int where m = ... -- $cm :: Show b => Int -> b -> ...
f :: forall a b. (C a, Show b) => ...
f $dC $dShow = ... m @a $dC @b $dShow ...
main = ... f @Int @Bool ...
```
After we specialise `f` for `Int`, we'll see `m @a $dC @b $dShow` in the body of
`$sf`. But before this patch, Specialise doesn't apply the ClassOp/DFun rule to
rewrite to a call of the instance method for `C Int`, e.g., `$cm @Bool $dShow`.
As a result, Specialise couldn't further specialise `$cm` for `Bool`.
There's a better example in `Note [Specialisation modulo dictionary selectors]`.
This patch enables proper Specialisation, as follows:
1. In the App case of `specExpr`, try to apply the CalssOp/DictSel rule on the
head of the application
2. Attach an unfolding to freshly-bound dictionary ids such as `$dC` and
`$dShow` in `bindAuxiliaryDict`
NB: Without (2), (1) would be pointless, because `lookupRule` wouldn't be able
to look into the RHS of `$dC` to see the DFun.
(2) triggered #21332, because the Specialiser floats around dictionaries without
accounting for them in the `SpecEnv`'s `InScopeSet`, triggering a panic when
rewriting dictionary unfoldings.
Fixes #19644 and #21332.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I completely rewrote our Notes surrounding eta-reduction. The new entry point is
`Note [Eta reduction makes sense]`.
Then I went on to extend the Simplifier to maintain an evaluation context in the
form of a `SubDemand` inside a `SimplCont`. That `SubDemand` is useful for doing
eta reduction according to `Note [Eta reduction based on evaluation context]`,
which describes how Demand analysis, Simplifier and `tryEtaReduce` interact to
facilitate eta reduction in more scenarios.
Thus we fix #21261.
ghc/alloc perf marginally improves (-0.0%). A medium-sized win is when compiling
T3064 (-3%). It seems that haddock improves by 0.6% to 1.0%, too.
Metric Decrease:
T3064
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch, the lexer did a truly roundabout thing with the dot:
1. look up the varsym in reservedSymsFM and turn it into ITdot
2. under OverloadedRecordDot, turn it into ITvarsym
3. in varsym_(prefix|suffix|...) turn it into ITvarsym, ITdot, or
ITproj, depending on extensions and whitespace
Turns out, the last step is sufficient to handle the dot correctly.
This patch removes the first two steps.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
previously, GHC had the "let/app-invariant" which said that the RHS of a
let or the argument of an application must be of lifted type or ok for
speculation. We want this on let to freely float them around, and we
wanted that on app to freely convert between the two (e.g. in
beta-reduction or inlining).
However, the app invariant meant that simple code didn't stay simple and
this got in the way of rules matching. By removing the app invariant,
this thus fixes #20554.
The new invariant is now called "let-can-float invariant", which is
hopefully easier to guess its meaning correctly.
Dropping the app invariant means that everywhere where we effectively do
beta-reduction (in the two simplifiers, but also in `exprIsConApp_maybe`
and other innocent looking places) we now have to check if the argument
must be evaluated (unlifted and side-effecting), and analyses have to be
adjusted to the new semantics of `App`.
Also, `LetFloats` in the simplifier can now also carry such non-floating
bindings.
The fix for DmdAnal, refine by Sebastian, makes functions with unlifted
arguments strict in these arguments, which changes some signatures.
This causes some extra calls to `exprType` and `exprOkForSpeculation`,
so some perf benchmarks regress a bit (while others improve).
Metric Decrease:
T9020
Metric Increase:
LargeRecord
T12545
T15164
T16577
T18223
T5642
T9961
Co-authored-by: Sebastian Graf <sebastian.graf@kit.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code was misusing isLexCon, which was never meant for validation.
In fact, its documentation states the following:
Use these functions to figure what kind of name a 'FastString'
represents; these functions do /not/ check that the identifier
is valid.
Ha! This sign can't stop me because I can't read.
The fix is to use okConOcc instead. The other checks (isTcOcc or
isDataOcc) seem superfluous, so I also removed those.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing notes weren't very clear on how the eta-expansion of
data constructors that occurs in tcInferDataCon/dsConLike interacts
with the representation polymorphism invariants. So we explain with
a few more details how we ensure that the representation-polymorphic
lambdas introduced by tcInferDataCon/dsConLike don't end up causing
problems, by checking they are properly instantiated and then relying
on the simple optimiser to perform beta reduction.
A few additional changes:
- ConLikeTc just take type variables instead of binders, as we
never actually used the binders.
- Removed the FRRApp constructor of FRROrigin; it was no longer used
now that we use ExpectedFunTyOrigin.
- Adds a bit of documentation to the constructors
of ExpectedFunTyOrigin.
|
|
|
|
|
|
| |
One more step towards the new design of EPA.
Updates the haddock submodule.
|
|
|
|
|
|
|
| |
This allows disabling of manual control centres in code a user doesn't control like
libraries.
Fixes #18867
|
|\ |
|
| |
| |
| |
| |
| |
| | |
* Non-fatal (i.e. recoverable) parse error
* Checking infix constructors
* Extended the regression test
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We were accidentally dropping the source location information in
certain circumstances when reporting redundant constraints. This patch
makes sure that we set the TcLclEnv correctly before reporting the
warning.
Fixes #21315
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Verifies two important properties of #includes in the RTS:
* That system headers don't appear inside of a `<BeginPrivate.h>` block
as this can hide system library symbols, resulting in very
hard-to-diagnose linker errors
* That no headers precede `Rts.h`, ensuring that __USE_MINGW_ANSI_STDIO
is set correctly before system headers are included.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This no-skolem-info bug was fixed by the no-skolem-info patch
that will be part of GHC 9.4. This patch adds a regression test for
the issue reported in issue #21338.
Fixes #21338.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The free-var test (now documented as (VD3)) was too narrow,
affecting only class predicates. #21302 demonstrated that
this wasn't enough!
Fixes #21302.
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch implements a small part of GHC Proposal #475.
The key change is in GHC.Types:
- data [] a = [] | a : [a]
+ data List a = [] | a : List a
And the rest of the patch makes sure that List is pretty-printed as []
in various contexts.
Updates the haddock submodule.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As #21144 showed, tryCastWorkerWrapper was calling prepareRhs, and
then unconditionally floating the bindings, without the checks of
doFloatFromRhs. That led to floating an unlifted binding into
a Rec group.
This patch refactors prepareBinding to make these checks,
and do them uniformly across all calls. A nice improvement.
Other changes
* Instead of passing around a RecFlag and a TopLevelFlag; and sometimes
a (Maybe SimplCont) for join points, define a new Simplifier-specific
data type BindContext:
data BindContext = BC_Let TopLevelFlag RecFlag
| BC_Join SimplCont
and use it consistently.
* Kill off completeNonRecX by inlining it. It was only called in
one place.
* Add a wrapper simplImpRules for simplRules.
Compile time on T9630 drops by 4.7%; little else changes.
Metric Decrease:
T9630
|
| |
| |
| |
| |
| |
| | |
Get rid of unnnecessary case clause that always matched.
Closes #20558
|
| | | |
| \ | |
| \ | |
| \ | |
|\ \ \ \
| |_|_|/
|/| | |
| | | | |
'wip/windows-clang-2' and 'wip/lint-rts-includes' into wip/windows-clang-join
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Verifies two important properties of #includes in the RTS:
* That system headers don't appear inside of a `<BeginPrivate.h>` block
as this can hide system library symbols, resulting in very
hard-to-diagnose linker errors
* That no headers precede `Rts.h`, ensuring that __USE_MINGW_ANSI_STDIO
is set correctly before system headers are included.
|
| | |
| | |
| | |
| | | |
Due to #21361.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Due to #20354.
We will need to investigate this prior the release.
|
| | |
| | |
| | |
| | | |
Our toolchain on Windows doesn't currently have Windows support.
|
| | |
| | |
| | |
| | |
| | | |
I'll admit, I don't currently see *why* this output is reordered
but it is a fairly benign difference and I'm out of time to investigate.
|
| | |
| | |
| | |
| | | |
`abort` exits with 255, not 134, on Windows.
|