summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Minor refactor around Outputablewip/outputable-cleanupKrzysztof Gogolewski2022-09-2112-110/+106
| | | | | | | * Replace 'text . show' and 'ppr' with 'int'. * Remove Outputable.hs-boot, no longer needed * Use pprWithCommas * Factor out instructions in AArch64 codegen
* Don't use isUnliftedType in isTaggedsheaf2022-09-213-5/+57
| | | | | | | | | The function GHC.Stg.InferTags.Rewrite.isTagged can be given the Id of a join point, which might be representation polymorphic. This would cause the call to isUnliftedType to crash. It's better to use typeLevity_maybe instead. Fixes #22212
* users-guide: fix incorrect ghcappdata folder for unix and windowsMon Aaraj2022-09-211-6/+5
|
* hadrian: Add extra_dependencies edges for all different waysMatthew Pickering2022-09-201-4/+8
| | | | | | | | | | | | | | | | | | | | The hack to add extra dependencies needed by DeriveLift extension missed the cases for profiles and dynamic ways. For the profiled way this leads to errors like: ``` GHC error in desugarer lookup in Data.IntSet.Internal: Failed to load interface for ‘Language.Haskell.TH.Lib.Internal’ Perhaps you haven't installed the profiling libraries for package ‘template-haskell’? Use -v (or `:set -v` in ghci) to see a list of the files searched for. ghc: panic! (the 'impossible' happened) GHC version 9.5.20220916: initDs ``` Therefore the fix is to add these extra edges in. Fixes #22197
* rts: remove copy-paste error from `cabal.rts.in`Nicolas Trangez2022-09-201-3/+0
| | | | | | This was, likely accidentally, introduced in 4bf542bf1c. See: 4bf542bf1cdf2fa468457fc0af21333478293476
* docs: clarify that LLVM codegen is not available in unregisterised modematoro2022-09-201-4/+3
| | | | | | | | | | | | | The current docs are misleading and suggest that it is possible to use LLVM codegen from an unregisterised build. This is not the case; attempting to pass `-fllvm` to an unregisterised build warns: ``` when making flags consistent: warning: Target platform uses unregisterised ABI, so compiling via C ``` and uses the C codegen anyway.
* Add notes to ghc-prim Haddocks that users should not import itTom Ellis2022-09-208-1/+26
|
* Relax instances for Functor combinators; put superclass on Class1 and Class2 ↵John Ericson2022-09-206-67/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to make non-breaking This change is approved by the Core Libraries commitee in https://github.com/haskell/core-libraries-committee/issues/10 The first change makes the `Eq`, `Ord`, `Show`, and `Read` instances for `Sum`, `Product`, and `Compose` match those for `:+:`, `:*:`, and `:.:`. These have the proper flexible contexts that are exactly what the instance needs: For example, instead of ```haskell instance (Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where (==) = eq1 ``` we do ```haskell deriving instance Eq (f (g a)) => Eq (Compose f g a) ``` But, that change alone is rather breaking, because until now `Eq (f a)` and `Eq1 f` (and respectively the other classes and their `*1` equivalents too) are *incomparable* constraints. This has always been an annoyance of working with the `*1` classes, and now it would rear it's head one last time as an pesky migration. Instead, we give the `*1` classes superclasses, like so: ```haskell (forall a. Eq a => Eq (f a)) => Eq1 f ``` along with some laws that canonicity is preserved, like: ```haskell liftEq (==) = (==) ``` and likewise for `*2` classes: ```haskell (forall a. Eq a => Eq1 (f a)) => Eq2 f ``` and laws: ```haskell liftEq2 (==) = liftEq1 ``` The `*1` classes also have default methods using the `*2` classes where possible. What this means, as explained in the docs, is that `*1` classes really are generations of the regular classes, indicating that the methods can be split into a canonical lifting combined with a canonical inner, with the super class "witnessing" the laws[1] in a fashion. Circling back to the pragmatics of migrating, note that the superclass means evidence for the old `Sum`, `Product`, and `Compose` instances is (more than) sufficient, so breakage is less likely --- as long no instances are "missing", existing polymorphic code will continue to work. Breakage can occur when a datatype implements the `*1` class but not the corresponding regular class, but this is almost certainly an oversight. For example, containers made that mistake for `Tree` and `Ord`, which I fixed in https://github.com/haskell/containers/pull/761, but fixing the issue by adding `Ord1` was extremely *un*controversial. `Generically1` was also missing `Eq`, `Ord`, `Read,` and `Show` instances. It is unlikely this would have been caught without implementing this change. ----- [1]: In fact, someday, when the laws are part of the language and not only documentation, we might be able to drop the superclass field of the dictionary by using the laws to recover the superclass in an instance-agnostic manner, e.g. with a *non*-overloaded function with type: ```haskell DictEq1 f -> DictEq a -> DictEq (f a) ``` But I don't wish to get into optomizations now, just demonstrate the close relationship between the law and the superclass. Bump haddock submodule because of test output changing.
* Add `Eq` and `Ord` instances for `Generically1`John Ericson2022-09-202-0/+10
| | | | | These are needed so the subsequent commit overhauling the `*1` classes type-checks.
* Fix -Woperator-whitespace for consym (part of #19372)Vladislav Zavialov2022-09-205-16/+63
| | | | | | | | | | | | | | Due to an oversight, the initial specification and implementation of -Woperator-whitespace focused on varsym exclusively and completely ignored consym. This meant that expressions such as "x+ y" would produce a warning, while "x:+ y" would not. The specification was corrected in ghc-proposals pull request #404, and this patch updates the implementation accordingly. Regression test included.
* Hadrian: merge archives even in stage 0sheaf2022-09-204-7/+18
| | | | | | | | | | | | | | | | We now always merge .a archives when ar supports -L. This change is necessary in order to bootstrap GHC using GHC 9.4 on Windows, as nested archives aren't supported. Not doing so triggered bug #21990 when trying to use the Win32 package, with errors such as: Not a x86_64 PE+ file. Unknown COFF 4 type in getHeaderInfo. ld.lld: error: undefined symbol: Win32zm2zi12zi0zi0_SystemziWin32ziConsoleziCtrlHandler_withConsoleCtrlHandler1_info We have to be careful about which ar is meant: in stage 0, the check should be done on the system ar (system-ar in system.config).
* Document :unadd GHCi command in user guideJan Hrček2022-09-202-11/+23
|
* CmmToC: emit __builtin_unreachable() after noreturn ccallsCheng Shao2022-09-191-1/+1
| | | | | | | Emit a __builtin_unreachable() call after a foreign call marked as CmmNeverReturns. This is crucial to generate correctly typed code for wasm; as for other archs, this is also beneficial for the C compiler optimizations.
* Scrub partiality about `NewOrData`.M Farkas-Dyck2022-09-1937-1422/+1514
| | | | | | | | Rather than a list of constructors and a `NewOrData` flag, we define `data DataDefnCons a = NewTypeCon a | DataTypeCons [a]`, which enforces a newtype to have exactly one constructor. Closes #22070. Bump haddock submodule.
* Lexer: define varsym without predicates (#22201)Vladislav Zavialov2022-09-181-28/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, the varsym lexing rules were defined as follows: <0> { @varsym / { precededByClosingToken `alexAndPred` followedByOpeningToken } { varsym_tight_infix } @varsym / { followedByOpeningToken } { varsym_prefix } @varsym / { precededByClosingToken } { varsym_suffix } @varsym { varsym_loose_infix } } Unfortunately, this meant that the predicates 'precededByClosingToken' and 'followedByOpeningToken' were recomputed several times before we could figure out the whitespace context. With this patch, we check for whitespace context directly in the lexer action: <0> { @varsym { with_op_ws varsym } } The checking for opening/closing tokens happens in 'with_op_ws' now, which is part of the lexer action rather than the lexer predicate.
* Lexer: pass updated buffer to actions (#22201)Vladislav Zavialov2022-09-181-54/+57
| | | | | | | | | | | | | | | | | | | | | In the lexer, predicates have the following type: { ... } :: user -- predicate state -> AlexInput -- input stream before the token -> Int -- length of the token -> AlexInput -- input stream after the token -> Bool -- True <=> accept the token This is documented in the Alex manual. There is access to the input stream both before and after the token. But when the time comes to construct the token, GHC passes only the initial string buffer to the lexer action. This patch fixes it: - type Action = PsSpan -> StringBuffer -> Int -> P (PsLocated Token) + type Action = PsSpan -> StringBuffer -> Int -> StringBuffer -> P (PsLocated Token) Now lexer actions have access to the string buffer both before and after the token, just like the predicates. It's just a matter of passing an additional function parameter throughout the lexer.
* DeriveFunctor: Check for last type variables using dataConUnivTyVarsRyan Scott2022-09-185-22/+107
| | | | | | | | | | | | | | | | Previously, derived instances of `Functor` (as well as the related classes `Foldable`, `Traversable`, and `Generic1`) would determine which constraints to infer by checking for fields that contain the last type variable. The problem was that this last type variable was taken from `tyConTyVars`. For GADTs, the type variables in each data constructor are _not_ the same type variables as in `tyConTyVars`, leading to #22167. This fixes the issue by instead checking for the last type variable using `dataConUnivTyVars`. (This is very similar in spirit to the fix for #21185, which also replaced an errant use of `tyConTyVars` with type variables from each data constructor.) Fixes #22167.
* rts: make threaded ways optionalCheng Shao2022-09-172-6/+18
| | | | | | | For certain targets (e.g. wasm32-wasi), the threaded rts is known not to work. This patch adds a "threaded" cabal flag to rts to make threaded rts ways optional. Hadrian enables this flag iff the flavour rtsWays contains threaded ways.
* rts: remove legacy logging cabal flagCheng Shao2022-09-171-2/+0
|
* driver: pass original Cmm filename in ModLocationCheng Shao2022-09-171-1/+1
| | | | | | | When compiling Cmm, the ml_hs_file field is used to indicate Cmm filename when later generating DWARF information. We should pass the original filename here, otherwise for preprocessed Cmm files, the filename will be a temporary filename which is confusing.
* Clean up some. In particular:M Farkas-Dyck2022-09-1749-389/+173
| | | | | | | | | | • Delete some dead code, largely under `GHC.Utils`. • Clean up a few definitions in `GHC.Utils.(Misc, Monad)`. • Clean up `GHC.Types.SrcLoc`. • Derive stock `Functor, Foldable, Traversable` for more types. • Derive more instances for newtypes. Bump haddock submodule.
* Hadrian: Don't try to build terminfo on Windowssheaf2022-09-161-2/+1
| | | | | Commit b42cedbe introduced a dependency on terminfo on Windows, but that package isn't available on Windows.
* -Wunused-pattern-binds: Recurse into patterns to check whether there's a spliceMatthew Pickering2022-09-165-14/+76
| | | | | | | | | | | | | | See the examples in #22057 which show we have to traverse deeply into a pattern to determine whether it contains a splice or not. The original implementation pointed this out but deemed this very shallow traversal "too expensive". Fixes #22057 I also fixed an oversight in !7821 which meant we lost a warning which was present in 9.2.2. Fixes #22067
* Add links to the continuations haddocks in the docs for each primopAlexis King2022-09-162-2/+8
| | | | fixes #22176
* hadrian: relax Cabal upper bound to allow building with Cabal-3.8Cheng Shao2022-09-161-1/+1
| | | | A follow up of !8910.
* Avoid partial head and tail in ghc-heap; replace with total pattern-matchingBodigrim2022-09-162-104/+83
|
* Update to Unicode 15.0Pierre Le Marre2022-09-1611-79/+80
|
* configure: remove unused program checksCheng Shao2022-09-161-5/+0
|
* hadrian: add late_ccs flavour transformerCheng Shao2022-09-161-0/+1
|
* hadrian: enable -fprof-late only for profiling waysCheng Shao2022-09-161-1/+1
|
* Stg.InferTags.Rewrite - Avoid some thunks.wip/andreask/infer_exprsAndreas Klebinger2022-09-151-9/+9
|
* Tag inference: Fix #21954 by retaining tagsigs of vars in function position.Andreas Klebinger2022-09-154-33/+201
| | | | | | | | | | For an expression like: case x of y Con z -> z If we also retain the tag sig for z we can generate code to immediately return it rather than calling out to stg_ap_0_fast.
* Fix typosKrzysztof Gogolewski2022-09-1464-84/+86
|
* Unbreak Hadrian with Cabal 3.8.M Farkas-Dyck2022-09-141-0/+4
|
* libraries: template-haskell: vendor filepath differentlyDouglas Wilson2022-09-145-1/+2249
| | | | | | Vendoring with ../ in hs-source-dirs prevents upload to hackage. (cherry picked from commit 1446be7586ba70f9136496f9b67f792955447842)
* Repair c++ probing on OpenBSDGreg Steuck2022-09-141-0/+1
| | | | | | | | | | Failure without this change: ``` checking C++ standard library flavour... libc++ checking for linkage against 'c++ c++abi'... failed checking for linkage against 'c++ cxxrt'... failed configure: error: Failed to find C++ standard library ```
* hadrian: Add extra implicit dependencies from DeriveLiftMatthew Pickering2022-09-142-2/+30
| | | | | | | ghc -M should know that modules which use DeriveLift (or TemplateHaskellQuotes) need TH.Lib.Internal but until it does, we have to add these extra edges manually or the modules will be compiled before TH.Lib.Internal is compiled which leads to a desugarer error.
* Remove stage1:exe:ghc-bin pre-build from CI scriptMatthew Pickering2022-09-141-4/+0
| | | | | | | | | | CI builds stage1:exe:ghc-bin before the binary-dist target which introduces some quite bad linearisation (see #22093) because we don't build stage1 compiler in parallel with anything. Then when the binary-dist target is started we have to build stage1:exe:ghc-pkg before doing anything. Fixes #22094
* hadrian: Need builders needed by Cabal Configure in parallelMatthew Pickering2022-09-144-29/+31
| | | | | | | | | | | | | Because of the use of withStaged (which needs the necessary builder) when configuring a package, the builds of stage1:exe:ghc-bin and stage1:exe:ghc-pkg where being linearised when building a specific target like `binary-dist-dir`. Thankfully the fix is quite local, to supply all the `withStaged` arguments together so the needs can be batched together and hence performed in parallel. Fixes #22093
* hadrian: Add some more packages to multi-cradleMatthew Pickering2022-09-142-11/+12
| | | | | | The main improvement here is to pass `-this-unit-id` for executables so that they can be added to the multi-cradle if desired as well as normal library packages.
* hadrian: Inplace/Final package databasesMatthew Pickering2022-09-1428-153/+318
| | | | | | | | | | | | | | | | | | | | | There are now two different package databases per stage. An inplace package database contains .conf files which point directly into the build directories. The final package database contains .conf files which point into the installed locations. The inplace .conf files are created before any building happens and have fake ABI hash values. The final .conf files are created after a package finished building and contains the proper ABI has. The motivation for this is to make the dependency structure more fine-grained when building modules. Now a module depends just depends directly on M.o from package p rather than the .conf file depend on the .conf file for package p. So when all of a modules direct dependencies have finished building we can start building it rather than waiting for the whole package to finish. The secondary motivation is that the multi-repl doesn't need to build everything before starting the multi-repl session. We can just configure the inplace package-db and use that in order to start the repl.
* hadrian: Use a stamp file to record when a package is built in a certain wayMatthew Pickering2022-09-145-4/+92
| | | | | | | | | | | Before this patch which library ways we had built wasn't recorded directly. So you would run into issues if you build the .conf file with some library ways before switching the library ways which you wanted to build. Now there is one stamp file for each way, so in order to build a specific way you can need that specific stamp file rather than going indirectly via the .conf file.
* hadrian: Bump index stateMatthew Pickering2022-09-141-1/+1
| | | | | | | This bumps the index state so a build plan can also be found when booting with 9.4. Fixes #22165
* Fix typosEric Lindblad2022-09-14194-434/+434
| | | | | | | This fixes various typos and spelling mistakes in the compiler. Fixes #21891
* compiler: remove unused lazy state monadCheng Shao2022-09-132-79/+0
|
* ci: remove unused appveyor configCheng Shao2022-09-132-75/+0
|
* Allow imports to reference multiple fields with the same name (#21625)Adam Gundry2022-09-137-23/+54
| | | | | | | | | | | | | | If a module `M` exports two fields `f` (using DuplicateRecordFields), we can still accept import M (f) import M hiding (f) and treat `f` as referencing both of them. This was accepted in GHC 9.0, but gave rise to an ambiguity error in GHC 9.2. See #21625. This patch also documents this behaviour in the user's guide, and updates the test for #16745 which is now treated differently.
* Diagnostic codes: acccept test changessheaf2022-09-132224-4578/+4819
| | | | | | | | The testsuite output now contains diagnostic codes, so many tests need to be updated at once. We decided it was best to keep the diagnostic codes in the testsuite output, so that contributors don't inadvertently make changes to the diagnostic codes.
* Add diagnostic codessheaf2022-09-1353-944/+2031
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR adds diagnostic codes, assigning unique numeric codes to error and warnings, e.g. error: [GHC-53633] Pattern match is redundant This is achieved as follows: - a type family GhcDiagnosticCode that gives the diagnostic code for each diagnostic constructor, - a type family ConRecursInto that specifies whether to recur into an argument of the constructor to obtain a more fine-grained code (e.g. different error codes for different 'deriving' errors), - generics machinery to generate the value-level function assigning each diagnostic its error code; see Note [Diagnostic codes using generics] in GHC.Types.Error.Codes. The upshot is that, to add a new diagnostic code, contributors only need to modify the two type families mentioned above. All logic relating to diagnostic codes is thus contained to the GHC.Types.Error.Codes module, with no code duplication. This MR also refactors error message datatypes a bit, ensuring we can derive Generic for them, and cleans up the logic around constraint solver reports by splitting up 'TcSolverReportInfo' into separate datatypes (see #20772). Fixes #21684
* Windows: Always define _UCRT when compiling C codeRyan Scott2022-09-126-1/+47
| | | | | | | As seen in #22159, this is required to ensure correct behavior when MinGW-w64 headers are in the `C_INCLUDE_PATH`. Fixes #22159.