| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Multiple home units allows you to load different packages which may depend on
each other into one GHC session. This will allow both GHCi and HLS to support
multi component projects more naturally.
Public Interface
~~~~~~~~~~~~~~~~
In order to specify multiple units, the -unit @⟨filename⟩ flag
is given multiple times with a response file containing the arguments for each unit.
The response file contains a newline separated list of arguments.
```
ghc -unit @unitLibCore -unit @unitLib
```
where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode.
```
-this-unit-id lib-core-0.1.0.0
-i
-isrc
LibCore.Utils
LibCore.Types
```
The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core.
```
-this-unit-id lib-0.1.0.0
-package-id lib-core-0.1.0.0
-i
-isrc
Lib.Parse
Lib.Render
```
Then when the compiler starts in --make mode it will compile both units lib and lib-core.
There is also very basic support for multiple home units in GHCi, at the
moment you can start a GHCi session with multiple units but only the
:reload is supported. Most commands in GHCi assume a single home unit,
and so it is additional work to work out how to modify the interface to
support multiple loaded home units.
Options used when working with Multiple Home Units
There are a few extra flags which have been introduced specifically for
working with multiple home units. The flags allow a home unit to pretend
it’s more like an installed package, for example, specifying the package
name, module visibility and reexported modules.
-working-dir ⟨dir⟩
It is common to assume that a package is compiled in the directory
where its cabal file resides. Thus, all paths used in the compiler
are assumed to be relative to this directory. When there are
multiple home units the compiler is often not operating in the
standard directory and instead where the cabal.project file is
located. In this case the -working-dir option can be passed which
specifies the path from the current directory to the directory the
unit assumes to be it’s root, normally the directory which contains
the cabal file.
When the flag is passed, any relative paths used by the compiler are
offset by the working directory. Notably this includes -i and
-I⟨dir⟩ flags.
-this-package-name ⟨name⟩
This flag papers over the awkward interaction of the PackageImports
and multiple home units. When using PackageImports you can specify
the name of the package in an import to disambiguate between modules
which appear in multiple packages with the same name.
This flag allows a home unit to be given a package name so that you
can also disambiguate between multiple home units which provide
modules with the same name.
-hidden-module ⟨module name⟩
This flag can be supplied multiple times in order to specify which
modules in a home unit should not be visible outside of the unit it
belongs to.
The main use of this flag is to be able to recreate the difference
between an exposed and hidden module for installed packages.
-reexported-module ⟨module name⟩
This flag can be supplied multiple times in order to specify which
modules are not defined in a unit but should be reexported. The
effect is that other units will see this module as if it was defined
in this unit.
The use of this flag is to be able to replicate the reexported
modules feature of packages with multiple home units.
Offsetting Paths in Template Haskell splices
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When using Template Haskell to embed files into your program,
traditionally the paths have been interpreted relative to the directory
where the .cabal file resides. This causes problems for multiple home
units as we are compiling many different libraries at once which have
.cabal files in different directories.
For this purpose we have introduced a way to query the value of the
-working-dir flag to the Template Haskell API. By using this function we
can implement a makeRelativeToProject function which offsets a path
which is relative to the original project root by the value of
-working-dir.
```
import Language.Haskell.TH.Syntax ( makeRelativeToProject )
foo = $(makeRelativeToProject "./relative/path" >>= embedFile)
```
> If you write a relative path in a Template Haskell splice you should use the makeRelativeToProject function so that your library works correctly with multiple home units.
A similar function already exists in the file-embed library. The
function in template-haskell implements this function in a more robust
manner by honouring the -working-dir flag rather than searching the file
system.
Closure Property for Home Units
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For tools or libraries using the API there is one very important closure
property which must be adhered to:
> Any dependency which is not a home unit must not (transitively) depend
on a home unit.
For example, if you have three packages p, q and r, then if p depends on
q which depends on r then it is illegal to load both p and r as home
units but not q, because q is a dependency of the home unit p which
depends on another home unit r.
If you are using GHC by the command line then this property is checked,
but if you are using the API then you need to check this property
yourself. If you get it wrong you will probably get some very confusing
errors about overlapping instances.
Limitations of Multiple Home Units
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a few limitations of the initial implementation which will be smoothed out on user demand.
* Package thinning/renaming syntax is not supported
* More complicated reexports/renaming are not yet supported.
* It’s more common to run into existing linker bugs when loading a
large number of packages in a session (for example #20674, #20689)
* Backpack is not yet supported when using multiple home units.
* Dependency chasing can be quite slow with a large number of
modules and packages.
* Loading wired-in packages as home units is currently not supported
(this only really affects GHC developers attempting to load
template-haskell).
* Barely any normal GHCi features are supported, it would be good to
support enough for ghcid to work correctly.
Despite these limitations, the implementation works already for nearly
all packages. It has been testing on large dependency closures,
including the whole of head.hackage which is a total of 4784 modules
from 452 packages.
Internal Changes
~~~~~~~~~~~~~~~~
* The biggest change is that the HomePackageTable is replaced with the
HomeUnitGraph. The HomeUnitGraph is a map from UnitId to HomeUnitEnv,
which contains information specific to each home unit.
* The HomeUnitEnv contains:
- A unit state, each home unit can have different package db flags
- A set of dynflags, each home unit can have different flags
- A HomePackageTable
* LinkNode: A new node type is added to the ModuleGraph, this is used to
place the linking step into the build plan so linking can proceed in
parralel with other packages being built.
* New invariant: Dependencies of a ModuleGraphNode can be completely
determined by looking at the value of the node. In order to achieve
this, downsweep now performs a more complete job of downsweeping and
then the dependenices are recorded forever in the node rather than
being computed again from the ModSummary.
* Some transitive module calculations are rewritten to use the
ModuleGraph which is more efficient.
* There is always an active home unit, which simplifies modifying a lot
of the existing API code which is unit agnostic (for example, in the
driver).
The road may be bumpy for a little while after this change but the
basics are well-tested.
One small metric increase, which we accept and also submodule update to
haddock which removes ExtendedModSummary.
Closes #10827
-------------------------
Metric Increase:
MultiLayerModules
-------------------------
Co-authored-by: Fendor <power.walross@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A declaration such as
infixr ++++
is supplied with an implicit fixity of 9 in the parser, but uses
an invalid SrcSpan to capture this. Use of this span triggers a panic.
Fix the problem by not recording an exact print annotation for the
non-existent fixity source.
Closes #20846
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The parser now accepts implicit parameters with higher-rank
types, such as
`foo :: (?ip :: forall a. a -> a) => ...`
Before this patch, we instead insisted on parentheses like so:
`foo :: (?ip :: (forall a. a -> a)) => ...`
The rest of the logic surrounding implicit parameters is unchanged;
in particular, even with ImpredicativeTypes, this idiom is not
likely to be very useful.
Fixes #20654
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit bddecda1a4c96da21e3f5211743ce5e4c78793a2.
This implements the first step in the plan formulated in #20025 to
improve the communication and migration strategy for the proposed
changes to Data.List.
Requires changing the haddock submodule to update the test output.
|
|
|
|
|
|
|
|
|
| |
When instances overlap, we now include additional information
about why we weren't able to select an instance: perhaps
one instance overlapped another but was not strictly more specific,
so we aren't able to directly choose it.
Fixes #20542
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ghc-exactPrint library has had to re-introduce the relatavise
phase.
This is needed if you change the length of an identifier and want the
layout to be preserved afterwards.
It is not possible to relatavise a bare SrcSpan, so introduce `SrcAnn
NoEpAnns` for them instead.
Updates haddock submodule.
|
|
|
|
| |
One more step towards the new design of EPA.
|
|
|
|
|
| |
This allows us to use an Anchor with a DeltaPos in it when exact
printing.
|
|
|
|
|
|
|
|
|
| |
Use an (Raw)PkgQual datatype instead of `Maybe FastString` to represent
package imports. Factorize the code that renames RawPkgQual into PkgQual
in function `rnPkgQual`. Renaming consists in checking if the FastString
is the magic "this" keyword, the home-unit unit-id or something else.
Bump haddock submodule
|
|
|
|
|
|
|
|
|
| |
Ensure the AddSemiAnn items appear in increasing order, so that if
they are converted to delta format they are still in the correct
order.
Prior to this the exact printer sorted by Span, which is meaningless
for EpaDelta locations.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like the built-in type defaulting rules these plugins can propose candidates
to resolve ambiguous type variables.
Machine learning and other large APIs like those for game engines introduce
new numeric types and other complex typed APIs. The built-in defaulting
mechanism isn't powerful enough to resolve ambiguous types in these cases forcing
users to specify minutia that they might not even know how to do. There is
an example defaulting plugin linked in the documentation. Applications include
defaulting the device a computation executes on, if a gradient should be
computed for a tensor, or the size of a tensor.
See https://github.com/ghc-proposals/ghc-proposals/pull/396 for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There were two problems around `mkDictErr`:
1. An outdated call to `flattenTys` meant that we missed out on some
instances. As we no longer flatten type-family applications,
the logic is obsolete and can be removed.
2. We reported "out of scope" errors in a poly-kinded situation
because `BoxedRep` and `Lifted` were considered out of scope.
We fix this by using `pretendNameIsInScope`.
fixes #20465
|
|
|
|
|
|
|
| |
The parens EPAs were added in the tyvars where they belong, but also
at the top level of the declaration.
Closes #20452
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This (big) commit finishes porting the GHC.Tc.Deriv module to support
the new diagnostic infrastructure (#18516) by getting rid of the legacy
calls to `TcRnUnknownMessage`. This work ended up being quite pervasive
and touched not only the Tc.Deriv module but also the Tc.Deriv.Utils and
Tc.Deriv.Generics module, which needed to be adapted to use the new
infrastructure. This also required generalising `Validity`.
More specifically, this is a breakdown of the work done:
* Add and use the TcRnUselessTypeable data constructor
* Add and use TcRnDerivingDefaults data constructor
* Add and use the TcRnNonUnaryTypeclassConstraint data constructor
* Add and use TcRnPartialTypeSignatures
* Add T13324_compile2 test to test another part of the
TcRnPartialTypeSignatures diagnostic
* Add and use TcRnCannotDeriveInstance data constructor, which introduces a
new data constructor to TcRnMessage called TcRnCannotDeriveInstance, which
is further sub-divided to carry a `DeriveInstanceErrReason` which explains
the reason why we couldn't derive a typeclass instance.
* Add DerivErrSafeHaskellGenericInst data constructor to DeriveInstanceErrReason
* Add DerivErrDerivingViaWrongKind and DerivErrNoEtaReduce
* Introduce the SuggestExtensionInOrderTo Hint, which adds (and use) a new
constructor to the hint type `LanguageExtensionHint` called `SuggestExtensionInOrderTo`,
which can be used to give a bit more "firm" recommendations when it's
obvious what the required extension is, like in the case for the
`DerivingStrategies`, which automatically follows from having enabled
both `DeriveAnyClass` and `GeneralizedNewtypeDeriving`.
* Wildcard-free pattern matching in mk_eqn_stock, which removes `_` in
favour of pattern matching explicitly on `CanDeriveAnyClass` and
`NonDerivableClass`, because that determine whether or not we can
suggest to the user `DeriveAnyClass` or not.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The EpaAnnCO we were using contained an Anchor instead of EpaLocation,
making it harder to work with.
At the same time, using EpaLocation by itself isn't possible either,
as we may have tokens without location information.
Hence the new data type:
data TokenLocation = NoTokenLoc
| TokenLoc !EpaLocation
|
|
|
|
|
|
| |
NoGhcTc is removed from HsMatchContext. As a result of this,
HsMatchContext GhcTc is now a valid type that has Id in it,
instead of Name and tcMatchesFun now takes Id instead of Name.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the following
foo = x
where -- do stuff
doStuff = do stuff
The "-- do stuff" comment is captured in the HsValBinds.
Closes #20297
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order:
* Introduce the `PsErrUnknownOptionsPragma` diagnostic message
This commit changes the diagnostic emitted inside
`GHC.Parser.Header.checkProcessArgsResult` from an (erroneous) and
unstructured `DriverUnknownMessage` to a `PsErrUnknownOPtionsPragma`,
i.e. a new data constructor of a `PsHeaderMessage`.
* Add the `DriverUserDefinedRuleIgnored` diagnostic message
* Add `DriverUserDefinedRuleIgnored` data constructor
This commit adds (and use) a new data constructor to the `DriverMessage`
type, replacing a `DriverUnknownMessage` with it.
* Add and use `DriverCannotLoadInterfaceFile` constructor
This commit introduces the DriverCannotLoadInterfaceFile constructor for
the `DriverMessage` type and it uses it to replace and occurrence of
`DriverUnknownMessage`.
* Add and use the `DriverInferredSafeImport` constructor
This commit adds a new `DriverInferredSafeImport` constructor to the
`DriverMessage` type, and uses it in `GHC.Driver.Main` to replace one
occurrence of `DriverUnknownMessage`.
* Add and use `DriverCannotImportUnsafeModule` constructor
This commit adds the `DriverCannotImportUnsafeModule` constructor
to the `DriverMessage` type, and later using it to replace one usage of
`DriverUnknownMessage` in the `GHC.Driver.Main` module.
* Add and use `DriverMissingSafeHaskellMode` constructor
* Add and use `DriverPackageNotTrusted` constructor
* Introduce and use `DriverInferredSafeModule` constructor
* Add and use `DriverMarkedTrustworthyButInferredSafe` constructor
* Add and use `DriverCannotImportFromUntrustedPackage`
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit refactors the SuggestExtension type constructor of the
GhcHint to be more powerful and flexible. In particular, we can now
embed extra user information (essentially "sugar") to help clarifying
the suggestion. This makes the following possible:
Suggested fix: Perhaps you intended to use GADTs
or a similar language extension to enable syntax: data T where
We can still give to IDEs and tools a `LangExt.Extension` they can use,
but in the pretty-printed message we can tell the user a bit more on why
such extension is needed.
On top of that, we now have the ability to express conjuctions and
disjunctons, for those cases where GHC suggests to enable "X or Y" and
for the cases where we need "X and Y".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds proper hints to most diagnostic types in the
`GHC.Parser.Errors.Types` module. By "proper" we mean that previous to
this commit the hints were bundled together with the diagnostic message,
whereas now we moved most of them as proper `[GhcHint]` in the
implementation of `diagnosticHints`.
More specifically, this is the list of constructors which now has
proper hints:
* PsErrIllegalBangPattern
* PsWarnOperatorWhitespaceExtConflict
* PsErrLambdaCase
* PsErrIllegalPatSynExport
* PsWarnOperatorWhitespace
* PsErrMultiWayIf
* PsErrIllegalQualifiedDo
* PsErrNumUnderscores
* PsErrLinearFunction
* PsErrIllegalTraditionalRecordSyntax
* PsErrIllegalExplicitNamespace
* PsErrOverloadedRecordUpdateNotEnabled
* PsErrIllegalDataTypeContext
* PsErrSemiColonsInCondExpr
* PsErrSemiColonsInCondCmd
* PsWarnStarIsType
* PsWarnImportPreQualified
* PsErrImportPostQualified
* PsErrEmptyDoubleQuotes
* PsErrIllegalRoleName
* PsWarnStarBinder
For some reason, this patch increases the peak_megabyte_allocated of
the T11545 test to 90 (from a baseline of 80) but that particular test
doesn't emit any parsing diagnostic or hint and the metric increase
happens only for the `aarch64-linux-deb10`.
Metric Increase:
T11545
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Fix found by Adam Gundry.
|
|
|
|
|
|
| |
Another step towards a simpler design for exact printing.
Updates the haddock submodule.
|
|
|
|
|
|
|
|
| |
- Move 'count-deps' into 'ghc/utils' so that it can be called standalone.
- Move 'testsuite/tests/parser/should_run/' tests 'CountParserDeps' and
'CountAstDeps' to 'testsuite/tests/count-deps' and reimplement in terms
of calling the utility
- Document how to use 'count-deps' in 'ghc/utils/count-deps/README'
|
|
|
|
|
|
|
|
|
|
|
| |
This commit replaces the PsUnknownMessage diagnostics over at
`GHC.Parser.Header` with a new `PsHeaderMessage` type (part of
the more general `PsMessage`), so that we can throw parser header's
errors which can be correctly caught by `GHC.Driver.Pipeline.preprocess`
and rewrapped (correctly) as Driver messages (using the
`DriverPsHeaderMessage`).
This gets rid of the nasty compiler crash as part of #19923.
|
|
|
|
|
|
|
|
|
|
|
| |
This commit converts a bunch of HsToCore (Ds) messages to use the new
GHC's diagnostic message infrastructure. In particular the DsMessage
type has been expanded with a lot of type constructors, each
encapsulating a particular error and warning emitted during desugaring.
Due to the fact that levity polymorphism checking can happen both at the
Ds and at the TcRn level, a new `TcLevityCheckDsMessage` constructor has
been added to the `TcRnMessage` type.
|
|
|
|
|
|
|
|
| |
The tests `CountParserDeps.hs` and `CountAstDeps.hs` are implemented
by calling `CountDeps`. In this MR, `CountDeps.printDeps` is updated
such tat by uncommenting a line, you can print a module's dependency
graph showing what includes what. The output is in a format suitable
for use with graphviz.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch, GHC used to silently accept programs such as the
following:
data R where
D1 :: { d1 :: Int } %1 -> R
The %1 annotation was completely ignored. Now it is a proper error.
One remaining issue is that in the error message (⊸) turns
into (%1 ->). This is to be corrected with upcoming exactprint updates.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GHC's internal State monad benefits from oneShot annotations on its
state, allowing for more aggressive eta expansion.
We currently don't have monad transformers with the same optimisation,
so we only change uses of the pure State monad here.
See #19657 and 19380.
Metric Decrease:
hie002
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit converts the lexers and all the parser machinery to use the
new parser types and diagnostics infrastructure. Furthermore, it cleans
up the way the parser code was emitting hints.
As a result of this systematic approach, the test output of the
`InfixAppPatErr` and `T984` tests have been changed. Previously they
would emit a `SuggestMissingDo` hint, but this was not at all helpful in
resolving the error, and it was even confusing by just looking at the
original program that triggered the errors.
Update haddock submodule
|
|
|
|
| |
This patch is a first step towards a simpler design for exact printing.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes a space leak related to the use of
Maybe in RealSrcSpan by introducing a strict variant
of Maybe.
In addition to that, it also introduces a strict pair
and uses the newly introduced strict data types in a few
other places (e.g. the lexer/parser state) to reduce
allocations.
Includes a regression test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit extends the GHC diagnostic hierarchy with a `GhcHint` type,
modelling helpful suggestions emitted by GHC which can be used to deal
with a particular warning or error.
As a direct consequence of this, the `Diagnostic` typeclass has been extended
with a `diagnosticHints` method, which returns a `[GhcHint]`. This means
that now we can clearly separate out the printing of the diagnostic
message with the suggested fixes.
This is done by extending the `printMessages` function in
`GHC.Driver.Errors`.
On top of that, the old `PsHint` type has been superseded by the new `GhcHint`
type, which de-duplicates some hints in favour of a general `SuggestExtension`
constructor that takes a `GHC.LanguageExtensions.Extension`.
|
|
|
|
|
|
|
|
| |
They are repeated in the surrounding DataDecl and FamEqn.
Updates haddock submodule
Closes #19834
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit modifies interface files so that *only* direct information
about modules and packages is stored in the interface file.
* Only direct module and direct package dependencies are stored in the
interface files.
* Trusted packages are now stored separately as they need to be checked
transitively.
* hs-boot files below the compiled module in the home module are stored
so that eps_is_boot can be calculated in one-shot mode without loading
all interface files in the home package.
* The transitive closure of signatures is stored separately
This is important for two reasons
* Less recompilation is needed, as motivated by #16885, a lot of
redundant compilation was triggered when adding new imports deep in the
module tree as all the parent interface files had to be redundantly
updated.
* Checking an interface file is cheaper because you don't have to
perform a transitive traversal to check the dependencies are up-to-date.
In the code, places where we would have used the transitive closure, we
instead compute the necessary transitive closure. The closure is not
computed very often, was already happening in checkDependencies, and
was already happening in getLinkDeps.
Fixes #16885
-------------------------
Metric Decrease:
MultiLayerModules
T13701
T13719
-------------------------
|
|
|
|
|
|
|
| |
The SrcSpan for a type family declaration did not include the family
equations.
Closes #19821
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no reason to use CPP. __LINE__ and __FILE__ macros are now
better replaced with GHC's CallStack. As a bonus, assert error messages
now contain more information (function name, column).
Here is the mapping table (HasCallStack omitted):
* ASSERT: assert :: Bool -> a -> a
* MASSERT: massert :: Bool -> m ()
* ASSERTM: assertM :: m Bool -> m ()
* ASSERT2: assertPpr :: Bool -> SDoc -> a -> a
* MASSERT2: massertPpr :: Bool -> SDoc -> m ()
* ASSERTM2: assertPprM :: m Bool -> SDoc -> m ()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch was driven by #18481, to allow visible type application
for levity-polymorphic newtypes. As so often, it started simple
but grew:
* Significant refactor: I removed HsConLikeOut from the
client-independent Language.Haskell.Syntax.Expr, and put it where it
belongs, as a new constructor `ConLikeTc` in the GHC-specific extension
data type for expressions, `GHC.Hs.Expr.XXExprGhcTc`.
That changed touched a lot of files in a very superficial way.
* Note [Typechecking data constructors] explains the main payload.
The eta-expansion part is no longer done by the typechecker, but
instead deferred to the desugarer, via `ConLikeTc`
* A little side benefit is that I was able to restore VTA for
data types with a "stupid theta": #19775. Not very important,
but the code in GHC.Tc.Gen.Head.tcInferDataCon is is much, much
more elegant now.
* I had to refactor the levity-polymorphism checking code in
GHC.HsToCore.Expr, see
Note [Checking for levity-polymorphic functions]
Note [Checking levity-polymorphic data constructors]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For the source
module MatchSemis where
{
a 0 = 1;
a _ = 2;
}
Make sure that the AddSemiAnn entries for the two trailing semicolons
are attached to the component Match elements.
Closes #19784
|