summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the treatment of loopy superclass dictswip/T20666Richard Eisenberg2023-01-1154-794/+1293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completely re-engineers how we deal with loopy superclass dictionaries in instance declarations. It fixes #20666 and #19690 The highlights are * Recognise that the loopy-superclass business should use precisely the Paterson conditions. This is much much nicer. See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance * With that in mind, define "Paterson-smaller" in Note [Paterson conditions] in GHC.Tc.Validity, and the new data type `PatersonSize` in GHC.Tc.Utils.TcType, along with functions to compute and compare PatsonSizes * Use the new PatersonSize stuff when solving superclass constraints See Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance * In GHC.Tc.Solver.Monad.lookupInInerts, add a missing call to prohibitedSuperClassSolve. This was the original cause of #20666. * Treat (TypeError "stuff") as having PatersonSize zero. See Note [Paterson size for type family applications] in GHC.Tc.Utils.TcType. * Treat the head of a Wanted quantified constraint in the same way as the superclass of an instance decl; this is what fixes #19690. See GHC.Tc.Solver.Canonical Note [Solving a Wanted forall-constraint] (Thanks to Matthew Craven for this insight.) This entailed refactoring the GivenSc constructor of CtOrigin a bit, to say whether it comes from an instance decl or quantified constraint. * Some refactoring way in which redundant constraints are reported; we don't want to complain about the extra, apparently-redundant constraints that we must add to an instance decl because of the loopy-superclass thing. I moved some work from GHC.Tc.Errors to GHC.Tc.Solver. * Add a new section to the user manual to describe the loopy superclass issue and what rules it follows.
* Misc cleanupKrzysztof Gogolewski2023-01-1112-37/+24
| | | | | | | | - Remove unused mkWildEvBinder - Use typeTypeOrConstraint - more symmetric and asserts that that the type is Type or Constraint - Fix escape sequences in Python; they raise a deprecation warning with -Wdefault
* Introduce the TypeAbstractions language flagVladislav Zavialov2023-01-1118-88/+119
| | | | | | | | | | | | | | | | | | | | | | | | | GHC Proposals #448 "Modern scoped type variables" and #425 "Invisible binders in type declarations" introduce a new language extension flag: TypeAbstractions. Part of the functionality guarded by this flag has already been implemented, namely type abstractions in constructor patterns, but it was guarded by a combination of TypeApplications and ScopedTypeVariables instead of a dedicated language extension flag. This patch does the following: * introduces a new language extension flag TypeAbstractions * requires TypeAbstractions for @a-syntax in constructor patterns instead of TypeApplications and ScopedTypeVariables * creates a User's Guide page for TypeAbstractions and moves the "Type Applications in Patterns" section there To avoid a breaking change, the new flag is implied by ScopedTypeVariables and is retroactively added to GHC2021. Metric Decrease: MultiLayerModulesTH_OneShot
* testsuite: Drop testheapalloced.cBen Gamari2023-01-111-100/+0
| | | | | | | As noted in #22414, this file (which appears to be a benchmark for characterising the one-step allocator's MBlock cache) is currently unreferenced. Remove it. Closes #22414.
* Added a new warning about compatibility with RequiredTypeArgumentsHaskellMouse2023-01-1132-4/+239
| | | | | | | | | This commit introduces a new warning that indicates code incompatible with future extension: RequiredTypeArguments. Enabling this extension may break some code and the warning will help to make it compatible in advance.
* m4/fp_leading_underscore.m4: Avoid implicit exit function declarationFlorian Weimer2023-01-111-6/+4
| | | | | | | And switch to a new-style function definition. Fixes build issues with compilers that do not accept implicit function declarations.
* fix missing haddock pipeJade Lovelace2023-01-111-1/+1
|
* Fix tcPluginRewrite exampleJade Lovelace2023-01-111-1/+1
|
* Revert "NCG(x86): Compile add+shift as lea if possible."Matthew Pickering2023-01-094-95/+0
| | | | | | This reverts commit 20457d775885d6c3df020d204da9a7acfb3c2e5a. See #22666 and #21777
* Fix outdated link to Happy section on sequencesGeorgi Lyubenov2023-01-091-2/+3
|
* Check for FP_LD_NO_FIXUP_CHAINS in installation configure scriptMatthew Pickering2023-01-091-0/+5
| | | | | | | Otherwise, when installing from a bindist the C flag isn't passed to the C compiler. This completes the fix for #22429
* Store bootstrap_llvm_target and use it to set LlvmTarget in bindistsMatthew Pickering2023-01-093-1/+10
| | | | | | | | | | This mirrors some existing logic for the bootstrap_target which influences how TargetPlatform is set. As described on #21970 not storing this led to `LlvmTarget` being set incorrectly and hence the wrong `--target` flag being passed to the C compiler. Towards #21970
* rts, tests: limit thread name length to 15 bytesNicolas Trangez2023-01-093-2/+8
| | | | | | | | | | | | | On Linux, `pthread_setname_np` (or rather, the kernel) only allows for thread names up to 16 bytes, including the terminating null byte. This commit adds a note pointing this out in `createOSThread`, and fixes up two instances where a thread name of more than 15 characters long was used (in the RTS, and in a test-case). Fixes: #22366 Fixes: https://gitlab.haskell.org/ghc/ghc/-/issues/22366 See: https://gitlab.haskell.org/ghc/ghc/-/issues/22366#note_460796
* Add safe list indexing operator: !?Oleg Grenrus2023-01-094-5/+34
| | | | | | With Joachim's amendments. Implements https://github.com/haskell/core-libraries-committee/issues/110
* Handle shadowing in DmdAnal (#22718)Sebastian Graf2023-01-091-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, when we had a shadowing situation like ```hs f x = ... -- demand signature <1L><1L> main = ... \f -> f 1 ... ``` we'd happily use the shadowed demand signature at the call site inside the lambda. Of course, that's wrong and solution is simply to remove the demand signature from the `AnalEnv` when we enter the lambda. This patch does so for all binding constructs Core. In #22718 the issue was caused by LetUp not shadowing away the existing demand signature for the let binder in the let body. The resulting absent error is fickle to reproduce; hence no reproduction test case. #17478 would help. Fixes #22718. It appears that TcPlugin_Rewrite regresses by ~40% on Darwin. It is likely that DmdAnal was exploiting ill-scoped analysis results. Metric increase ['bytes allocated'] (test_env=x86_64-darwin-validate): TcPlugin_Rewrite
* Remove RTS hack for configuringJohn Ericson2023-01-093-6/+46
| | | | | See the brand new Note [Undefined symbols in the RTS] for additional details.
* EPA: exact print HsDocTyAlan Zimmerman2023-01-095-2/+20
| | | | | To match ghc-exactprint https://github.com/alanz/ghc-exactprint/pull/121
* Disable split sections on aarch64-deb10 buildMatthew Pickering2023-01-092-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See #22722 Failure on this job: https://gitlab.haskell.org/ghc/ghc/-/jobs/1287852 ``` Unexpected failures: /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test spaces/testsuite/tests/th/T10828.run T10828 [exit code non-0] (ext-interp) /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test spaces/testsuite/tests/th/T13123.run T13123 [exit code non-0] (ext-interp) /builds/ghc/ghc/tmp/ghctest-s3d8g1hj/test spaces/testsuite/tests/th/T20590.run T20590 [exit code non-0] (ext-interp) Appending 232 stats to file: /builds/ghc/ghc/performance-metrics.tsv ``` ``` Compile failed (exit code 1) errors were: data family D_0 a_1 :: * -> * data instance D_0 GHC.Types.Int GHC.Types.Bool :: * where DInt_2 :: D_0 GHC.Types.Int GHC.Types.Bool data E_3 where MkE_4 :: a_5 -> E_3 data Foo_6 a_7 b_8 where MkFoo_9, MkFoo'_10 :: a_11 -> Foo_6 a_11 b_12 newtype Bar_13 :: * -> GHC.Types.Bool -> * where MkBar_14 :: a_15 -> Bar_13 a_15 b_16 data T10828.T (a_0 :: *) where T10828.MkT :: forall (a_1 :: *) . a_1 -> a_1 -> T10828.T a_1 T10828.MkC :: forall (a_2 :: *) (b_3 :: *) . (GHC.Types.~) a_2 GHC.Types.Int => {T10828.foo :: a_2, T10828.bar :: b_3} -> T10828.T GHC.Types.Int T10828.hs:1:1: error: [GHC-87897] Exception when trying to run compile-time code: ghc-iserv terminated (-4) Code: (do TyConI dec <- runQ $ reify (mkName "T") runIO $ putStrLn (pprint dec) >> hFlush stdout d <- runQ $ [d| data T' a :: Type where MkT' :: a -> a -> T' a MkC' :: forall a b. (a ~ Int) => {foo :: a, bar :: b} -> T' Int |] runIO $ putStrLn (pprint d) >> hFlush stdout ....) *** unexpected failure for T10828(ext-interp) =====> 7000 of 9215 [0, 1, 0] =====> 7000 of 9215 [0, 1, 0] =====> 7000 of 9215 [0, 1, 0] =====> 7000 of 9215 [0, 1, 0] Compile failed (exit code 1) errors were: T13123.hs:1:1: error: [GHC-87897] Exception when trying to run compile-time code: ghc-iserv terminated (-4) Code: ([d| data GADT where MkGADT :: forall k proxy (a :: k). proxy a -> GADT |]) *** unexpected failure for T13123(ext-interp) =====> 7100 of 9215 [0, 2, 0] =====> 7100 of 9215 [0, 2, 0] =====> 7200 of 9215 [0, 2, 0] Compile failed (exit code 1) errors were: T20590.hs:1:1: error: [GHC-87897] Exception when trying to run compile-time code: ghc-iserv terminated (-4) Code: ([d| data T where MkT :: forall a. a -> T |]) *** unexpected failure for T20590(ext-interp) ``` Looks fairly worrying to me.
* Pass -Wl,-no_fixup_chains to ld64 when appropiateMatthew Pickering2023-01-072-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent versions of MacOS use a version of ld where `-fixup_chains` is on by default. This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we explicitly disable `fixup-chains` by passing `-no_fixup_chains` to the linker on darwin. This results in a warning of the form: ld: warning: -undefined dynamic_lookup may not work with chained fixups The manual explains the incompatible nature of these two flags: -undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error. Note: dynamic_lookup that depends on lazy binding will not work with chained fixups. A relevant ticket is #22429 Here are also a few other links which are relevant to the issue: Official comment: https://developer.apple.com/forums/thread/719961 More relevant links: https://openradar.appspot.com/radar?id=5536824084660224 https://github.com/python/cpython/issues/97524 Note in release notes: https://developer.apple.com/documentation/xcode-release-notes/xcode-13-releas e-notes
* Skip T18623 on darwin (to add to the long list of OSs)Matthew Pickering2023-01-071-0/+2
| | | | | | | | | | | On recent versions of OSX, running `ulimit -v` results in ``` ulimit: setrlimit failed: invalid argument ``` Time is too short to work out what random stuff Apple has been doing with ulimit, so just skip the test like we do for other platforms.
* T10955: Set DYLD_LIBRARY_PATH for darwinMatthew Pickering2023-01-071-1/+1
| | | | | | | | | | The correct path to direct the dynamic linker on darwin is DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH. On recent versions of OSX using LD_LIBRARY_PATH seems to have stopped working. For more reading see: https://stackoverflow.com/questions/3146274/is-it-ok-to-use-dyld-library-path-on-mac-os-x-and-whats-the-dynamic-library-s
* Make FloatIn robust to shadowingSimon Peyton Jones2023-01-073-103/+165
| | | | | | | | | | This MR fixes #22622. See the new Note [Shadowing and name capture] I did a bit of refactoring in sepBindsByDropPoint too. The bug doesn't manifest in HEAD, but it did show up in 9.4, so we should backport this patch to 9.4
* rts: MUT_VAR is not a StgMutArrPtrsBen Gamari2023-01-061-2/+1
| | | | There was previously a comment claiming that the MUT_VAR closure type had the layout of StgMutArrPtrs.
* darwin ci: Explicitly pass desired build triple to configureMatthew Pickering2023-01-061-1/+1
| | | | | | On the zw3rk machines for some reason the build machine was inferred to be arm64. Setting the build triple appropiately resolve this confusion and we produce x86 binaries.
* ci: Upgrade darwin, windows and freebsd CI to use GHC-9.4.3Matthew Pickering2023-01-064-28/+47
| | | | Fixes #22599
* Only store Name in FunRhs rather than Id with knot-tied fieldsMatthew Pickering2023-01-0618-80/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | All the issues here have been caused by #18758. The goal of the ticket is to be able to talk about things like `LTyClDecl GhcTc`. In the case of HsMatchContext, the correct "context" is whatever we want, and in fact storing just a `Name` is sufficient and correct context, even if the rest of the AST is storing typechecker Ids. So this reverts (#20415, !5579) which intended to get closed to #18758 but didn't really and introduced a few subtle bugs. Printing of an error message in #22695 would just hang, because we would attempt to print the `Id` in debug mode to assertain whether it was empty or not. Printing the Name is fine for the error message. Another consequence is that when `-dppr-debug` was enabled the compiler would hang because the debug printing of the Id would try and print fields which were not populated yet. This also led to 32070e6c2e1b4b7c32530a9566fe14543791f9a6 having to add a workaround for the `checkArgs` function which was probably a very similar bug to #22695. Fixes #22695
* Add support for sized literals in the bytecode interpreter.Luite Stegeman2023-01-0611-16/+733
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bytecode interpreter only has branching instructions for word-sized values. These are used for pattern matching. Branching instructions for other types (e.g. Int16# or Word8#) weren't needed, since unoptimized Core or STG never requires branching on types like this. It's now possible for optimized STG to reach the bytecode generator (e.g. fat interface files or certain compiler flag combinations), which requires dealing with various sized literals in branches. This patch improves support for generating bytecode from optimized STG by adding the following new bytecode instructions: TESTLT_I64 TESTEQ_I64 TESTLT_I32 TESTEQ_I32 TESTLT_I16 TESTEQ_I16 TESTLT_I8 TESTEQ_I8 TESTLT_W64 TESTEQ_W64 TESTLT_W32 TESTEQ_W32 TESTLT_W16 TESTEQ_W16 TESTLT_W8 TESTEQ_W8 Fixes #21945
* Revert "configure: Drop uses of AC_PROG_CC_C99"Matthew Pickering2023-01-053-0/+48
| | | | | | | | | | This reverts commit 7c6de18dd3151ead954c210336728e8686c91de6. Centos7 using a very old version of the toolchain (autotools-2.69) where the behaviour of these macros has not yet changed. I am reverting this without haste as it is blocking the 9.6 branch. Fixes #22704
* HsToken in TypeArg (#19623)Vladislav Zavialov2023-01-0518-61/+84
| | | | Updates the haddock submodule.
* EPA: Do not collect comments from end of fileAlan Zimmerman2023-01-059-49/+192
| | | | | | | | In Parser.y semis1 production triggers for the virtual semi at the end of the file. This is detected by it being zero length. In this case, do not extend the span being used to gather comments, so any final comments are allocated at the module level instead.
* Misc cleanupKrzysztof Gogolewski2023-01-0528-90/+59
| | | | | | | | | - Remove unused uniques and hs-boot declarations - Fix types of seq and unsafeCoerce# - Remove FastString/String roundtrip in JS - Use TTG to enforce totality - Remove enumeration in Heap/Inspect; the 'otherwise' clause serves the primitive types well.
* sphinx: Use modern syntax for extlinksMatthew Pickering2023-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | This fixes the following build error: ``` Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273 ===> Command failed with error code: 2 Exception occurred: File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role title = caption % part ~~~~~~~~^~~~~~ TypeError: not all arguments converted during string formatting ``` I tested on Sphinx-5.1.1 and Sphinx-6.0.0 Thanks for sterni for providing instructions about how to test using sphinx-6.0.0. Fixes #22690
* packaging: Build perf builds with -split-sectionswip/various-hadrian-fixesMatthew Pickering2023-01-046-43/+63
| | | | | | | | | | | In 8f71d958 the make build system was made to use split-sections on linux systems but it appears this logic never made it to hadrian. There is the split_sections flavour transformer but this doesn't appear to be used for perf builds on linux. This is disbled on deb9 and windows due to #21670 Closes #21135
* hadrian: Document using GHC environment variable to select boot compilerMatthew Pickering2023-01-041-0/+12
| | | | Fixes #22340
* ci: Build all test dependencies with in-tree compilerMatthew Pickering2023-01-041-1/+1
| | | | | | | This means that these executables will honour flavour transformers such as "werror". Fixes #22555
* check-exact: Fix build with -WerrorMatthew Pickering2023-01-041-1/+2
|
* hadrian: Add no_split_sections tranformerMatthew Pickering2023-01-046-25/+53
| | | | | | | | | | | This transformer reverts the effect of `split_sections`, which we intend to use for platforms which don't support split sections. In order to achieve this we have to modify the implemntation of the split_sections transformer to store whether we are enabling split_sections directly in the `Flavour` definition. This is because otherwise there's no convenient way to turn off split_sections due to having to pass additional linker scripts when merging objects.
* hadrian: Add test:all_deps to build just testsuite dependenciesMatthew Pickering2023-01-042-0/+16
| | | | Fixes #22534
* hadrian: Fix computation of tables_next_to_code for outOfTreeCompilerMatthew Pickering2023-01-042-1/+3
| | | | This copy-pasto was introduced in de5fb3489f2a9bd6dc75d0cb8925a27fe9b9084b
* compiler: Add -f[no-]split-sections flagsMatthew Pickering2023-01-042-9/+15
| | | | | | | | Here we add a `-fsplit-sections` flag which may some day replace `-split-sections`. This has the advantage of automatically providing a `-fno-split-sections` flag, which is useful for our packaging because we enable `-split-sections` by default but want to disable it in certain configurations.
* Explain the auxiliary functions of permutationsFacundo Domínguez2023-01-031-0/+27
|
* Force the Docs structure to prevent leaks in GHCi with -haddock without ↵wip/force-docsZubin Duggal2023-01-0311-12/+76
| | | | | | | | | | -fwrite-interface Involves adding many new NFData instances. Without forcing Docs, references to the TcGblEnv for each module are retained by the Docs structure. Usually these are forced when the ModIface is serialised but not when we aren't writing the interface.
* Document infelicities of instance Ord Double and workaroundsBodigrim2022-12-241-23/+30
|
* hadrian: Ensure that linker scripts are used when merging objectsBen Gamari2022-12-241-2/+6
| | | | | | In #22527 @rui314 inadvertantly pointed out a glaring bug in Hadrian's implementation of the object merging rules: unlike the old `make` build system we utterly failed to pass the needed linker scripts. Fix this.
* Drop support for kind constraints.wip/p547Richard Eisenberg2022-12-2441-620/+156
| | | | | | | | | | | | | | | | | | | | | | | | This implements proposal 547 and closes ticket #22298. See the proposal and ticket for motivation. Compiler perf improves a bit Metrics: compile_time/bytes allocated ------------------------------------- CoOpt_Singletons(normal) -2.4% GOOD T12545(normal) +1.0% T13035(normal) -13.5% GOOD T18478(normal) +0.9% T9872d(normal) -2.2% GOOD geo. mean -0.2% minimum -13.5% maximum +1.0% Metric Decrease: CoOpt_Singletons T13035 T9872d
* Store RdrName rather than OccName in HolesMatthew Pickering2022-12-2419-56/+117
| | | | | | | | | | | | | | | | | In #20472 it was pointed out that you couldn't defer out of scope but the implementation collapsed a RdrName into an OccName to stuff it into a Hole. This leads to the error message for a deferred qualified name dropping the qualification which affects the quality of the error message. This commit adds a bit more structure to a hole, so a hole can replace a RdrName without losing information about what that RdrName was. This is important when printing error messages. I also added a test which checks the Template Haskell deferral of out of scope qualified names works properly. Fixes #22130
* gitlab-ci: Introduce aarch64-linux-llvm jobBen Gamari2022-12-242-0/+178
| | | | | | | This nightly job will ensure that we don't break the LLVM backend on AArch64/Linux by bootstrapping GHC. This would have caught #22640.
* llvmGen: Fix relaxed orderingBen Gamari2022-12-241-1/+1
| | | | | | | Previously I used LLVM's `unordered` ordering for the C11 `relaxed` ordering. However, this is wrong and should rather use the LLVM `monotonic` ordering. Fixes #22640
* ci: Run head.hackage jobs on upstream-testing branch rather than masterMatthew Pickering2022-12-241-1/+1
| | | | | | | | | This change allows less priviledged users to trigger head.hackage jobs because less permissions are needed to trigger jobs on the upstream-testing branch, which is not protected. There is a CI job which updates upstream-testing each hour to the state of the master branch so it should always be relatively up-to-date.
* ci: Don't run abi-test-nightly on release jobsMatthew Pickering2022-12-241-1/+0
| | | | | | The test is not configured to get the correct dependencies for the release pipelines (and indeed stops the release pipeline being run at all)