summaryrefslogtreecommitdiff
path: root/testsuite/tests
Commit message (Collapse)AuthorAgeFilesLines
* WIP: 22478 Type patternswip/int-index/tyconpat-scopingVladislav Zavialov2023-01-185-17/+103
|
* EPA: Add annotation for 'type' in DataDeclAlan Zimmerman2023-01-163-1/+69
| | | | Closes #22765
* Add regression test for #22611.Andreas Klebinger2023-01-163-0/+310
| | | | A case were a function used to fail to specialize, but now does.
* Separate core inlining logic from `Unfolding` type.Andreas Klebinger2023-01-162-0/+2
| | | | | This seems like a good idea either way, but is mostly motivated by a patch where this avoids a module loop.
* Add a missing checkEscapingKindSimon Peyton Jones2023-01-133-0/+18
| | | | | | | | Ticket #22743 pointed out that there is a missing check, for type-inferred bindings, that the inferred type doesn't have an escaping kind. The fix is easy.
* Bump submodule bytestring to 0.11.4.0Bodigrim2023-01-132-11/+13
| | | | | | Metric Decrease: T21839c T21839r
* Fix #22728: Not all diagnostics in safe check are fatalOleg Grenrus2023-01-128-0/+37
| | | | Also add tests for the issue and -Winferred-safe-imports in general
* Change MSYSTEM to CLANG64 uniformlyCheng Shao2023-01-121-3/+3
|
* Fix contification with stable unfoldings (#22428)Sebastian Graf2023-01-123-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many functions now return a `TailUsageDetails` that adorns a `UsageDetails` with a `JoinArity` that reflects the number of join point binders around the body for which the `UsageDetails` was computed. `TailUsageDetails` is now returned by `occAnalLamTail` as well as `occAnalUnfolding` and `occAnalRules`. I adjusted `Note [Join points and unfoldings/rules]` and `Note [Adjusting right-hand sides]` to account for the new machinery. I also wrote a new `Note [Join arity prediction based on joinRhsArity]` and refer to it when we combine `TailUsageDetails` for a recursive RHS. I also renamed * `occAnalLam` to `occAnalLamTail` * `adjustRhsUsage` to `adjustTailUsage` * a few other less important functions and properly documented the that each call of `occAnalLamTail` must pair up with `adjustTailUsage`. I removed `Note [Unfoldings and join points]` because it was redundant with `Note [Occurrences in stable unfoldings]`. While in town, I refactored `mkLoopBreakerNodes` so that it returns a condensed `NodeDetails` called `SimpleNodeDetails`. Fixes #22428. The refactoring seems to have quite beneficial effect on ghc/alloc performance: ``` CoOpt_Read(normal) ghc/alloc 784,778,420 768,091,176 -2.1% GOOD T12150(optasm) ghc/alloc 77,762,270 75,986,720 -2.3% GOOD T12425(optasm) ghc/alloc 85,740,186 84,641,712 -1.3% GOOD T13056(optasm) ghc/alloc 306,104,656 299,811,632 -2.1% GOOD T13253(normal) ghc/alloc 350,233,952 346,004,008 -1.2% T14683(normal) ghc/alloc 2,800,514,792 2,754,651,360 -1.6% T15304(normal) ghc/alloc 1,230,883,318 1,215,978,336 -1.2% T15630(normal) ghc/alloc 153,379,590 151,796,488 -1.0% T16577(normal) ghc/alloc 7,356,797,056 7,244,194,416 -1.5% T17516(normal) ghc/alloc 1,718,941,448 1,692,157,288 -1.6% T19695(normal) ghc/alloc 1,485,794,632 1,458,022,112 -1.9% T21839c(normal) ghc/alloc 437,562,314 431,295,896 -1.4% GOOD T21839r(normal) ghc/alloc 446,927,580 440,615,776 -1.4% GOOD geo. mean -0.6% minimum -2.4% maximum -0.0% ``` Metric Decrease: CoOpt_Read T10421 T12150 T12425 T13056 T18698a T18698b T21839c T21839r T9961
* Fix finaliseArgBoxities for OPAQUE functionSimon Peyton Jones2023-01-112-0/+16
| | | | | | | We never do worker wrapper for OPAQUE functions, so we must zap the unboxing info during strictness analysis. This patch fixes #22502
* Fix void-arg-adding mechanism for worker/wrapperSimon Peyton Jones2023-01-114-58/+76
| | | | | | | | | | | | | As #22725 shows, in worker/wrapper we must add the void argument /last/, not first. See GHC.Core.Opt.WorkWrap.Utils Note [Worker/wrapper needs to add void arg last]. That led me to to study GHC.Core.Opt.SpecConstr Note [SpecConstr needs to add void args first] which suggests the opposite! And indeed I think it's the other way round for SpecConstr -- or more precisely the void arg must precede the "extra_bndrs". That led me to some refactoring of GHC.Core.Opt.SpecConstr.calcSpecInfo.
* Parse qualified terms in type signaturesHaskellMouse2023-01-119-1/+62
| | | | | | | | This commit allows qualified terms in type signatures to pass the parser and to be cathced by renamer with more informative error message. Adds a few tests. Fixes #21605
* Refactor the treatment of loopy superclass dictswip/T20666Richard Eisenberg2023-01-1132-94/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-115-8/+8
| | | | | | | | - 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-1111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 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-1119-0/+125
| | | | | | | | | 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.
* Revert "NCG(x86): Compile add+shift as lea if possible."Matthew Pickering2023-01-093-59/+0
| | | | | | This reverts commit 20457d775885d6c3df020d204da9a7acfb3c2e5a. See #22666 and #21777
* rts, tests: limit thread name length to 15 bytesNicolas Trangez2023-01-091-1/+1
| | | | | | | | | | | | | 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
* EPA: exact print HsDocTyAlan Zimmerman2023-01-093-1/+14
| | | | | To match ghc-exactprint https://github.com/alanz/ghc-exactprint/pull/121
* 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-072-0/+7
| | | | | | | | | | 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
* Only store Name in FunRhs rather than Id with knot-tied fieldsMatthew Pickering2023-01-067-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-064-0/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* HsToken in TypeArg (#19623)Vladislav Zavialov2023-01-052-4/+18
| | | | Updates the haddock submodule.
* EPA: Do not collect comments from end of fileAlan Zimmerman2023-01-058-47/+188
| | | | | | | | 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-051-2/+0
| | | | | | | | | - 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.
* Drop support for kind constraints.wip/p547Richard Eisenberg2022-12-2422-160/+40
| | | | | | | | | | | | | | | | | | | | | | | | 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-245-4/+13
| | | | | | | | | | | | | | | | | 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
* Fix unifier bug: failing to decompose over-saturated type familySimon Peyton Jones2022-12-222-0/+22
| | | | This simple patch fixes #22647
* Refactor mkRuntimeErrorSimon Peyton Jones2022-12-222-0/+12
| | | | | | | | | This patch fixes #22634. Because we don't have TYPE/CONSTRAINT polymorphism, we need two error functions rather than one. I took the opportunity to rname runtimeError to impossibleError, to line up with mkImpossibleExpr, and avoid confusion with the genuine runtime-error-constructing functions.
* EPA: Make EOF position part of AnnsModuleAlan Zimmerman2022-12-2216-130/+96
| | | | | Closes #20951 Closes #19697
* Don't consider large byte arrays/compact regions pinned.Andreas Klebinger2022-12-223-5/+7
| | | | | Workaround for #22255 which showed how treating large/compact regions as pinned could cause segfaults.
* base: Bump version to 4.18Ben Gamari2022-12-212-2/+2
| | | | Requires various submodule bumps.
* Fix an assertion check in addToEqualCtListSimon Peyton Jones2022-12-213-0/+25
| | | | | | | The old assertion saw that a constraint ct could rewrite itself (of course it can) and complained (stupid). Fixes #22645
* Fix shadowing lacuna in OccurAnalSimon Peyton Jones2022-12-213-0/+95
| | | | | | | | | | | | Issue #22623 demonstrated another lacuna in the implementation of wrinkle (BS3) in Note [The binder-swap substitution] in the occurrence analyser. I was failing to add TyVar lambda binders using addInScope/addOneInScope and that led to a totally bogus binder-swap transformation. Very easy to fix.
* Abstract over the right free varsSimon Peyton Jones2022-12-212-0/+24
| | | | | | | | | | | | | | | | | Fix #22459, in two ways: (1) Make the Specialiser not create a bogus specialisation if it is presented by strangely polymorphic dictionary. See Note [Weird special case in SpecDict] in GHC.Core.Opt.Specialise (2) Be more careful in abstractFloats See Note [Which type variables to abstract over] in GHC.Core.Opt.Simplify.Utils. So (2) stops creating the excessively polymorphic dictionary in abstractFloats, while (1) stops crashing if some other pass should nevertheless create a weirdly polymorphic dictionary.
* Fix testsBodigrim2022-12-211-1/+1
| | | | | | | T13253 imports MonadTrans, which acquired a quantified constraint in transformers-0.6, thus increase in allocations Metric Increase: T13253
* testsuite: Mark T16392 as fragile on windowswip/fragile-testMatthew Pickering2022-12-201-1/+3
| | | | See #22649
* testsuite: Mark T9405 as fragile instead of broken on WindowsCheng Shao2022-12-161-1/+1
| | | | It's starting to pass again, and the unexpected pass blocks CI.
* checkValidInst: Don't expand synonyms when splitting sigma typesRyan Scott2022-12-153-0/+26
| | | | | | | | | | | | | | | Previously, the `checkValidInst` function (used when checking that an instance declaration is headed by an actual type class, not a type synonym) was using `tcSplitSigmaTy` to split apart the `forall`s and instance context. This is incorrect, however, as `tcSplitSigmaTy` expands type synonyms, which can cause instances headed by quantified constraint type synonyms to be accepted erroneously. This patch introduces `splitInstTyForValidity`, a variant of `tcSplitSigmaTy` specialized for validity checking that does _not_ expand type synonyms, and uses it in `checkValidInst`. Fixes #22570.
* Fix bogus test in LintSimon Peyton Jones2022-12-152-0/+11
| | | | | | | | | | | | The Lint check for branch compatiblity within an axiom, in GHC.Core.Lint.compatible_branches was subtly different to the check made when contructing an axiom, in GHC.Core.FamInstEnv.compatibleBranches. The latter is correct, so I killed the former and am now using the latter. On the way I did some improvements to pretty-printing and documentation.
* Package Imports: Get candidate packages also from re-exported modulesMatthew Pickering2022-12-1514-0/+132
| | | | | | | | Previously we were just looking at the direct imports to try and work out what a package qualifier could apply to but #22333 pointed out we also needed to look for reexported modules. Fixes #22333
* EPA: When splitting out header comments, keep ones for first declAlan Zimmerman2022-12-134-52/+82
| | | | | Any comments immediately preceding the first declaration are no longer kept as header comments, but attach to the first declaration instead.
* Fix loop in the interface representation of some `Unfolding` fieldsGergő Érdi2022-12-139-68/+108
| | | | | | | | | | | | | | | As discovered in #22272, dehydration of the unfolding info of a recursive definition used to involve a traversal of the definition itself, which in turn involves traversing the unfolding info. Hence, a loop. Instead, we now store enough data in the interface that we can produce the unfolding info without this traversal. See Note [Tying the 'CoreUnfolding' knot] for details. Fixes #22272 Co-authored-by: Simon Peyton Jones <simon.peytonjones@gmail.com>
* Respect -XStrict in the pattern-match checker (#21761)Sebastian Graf2022-12-133-0/+44
| | | | | | | | We were missing a call to `decideBangHood` in the pattern-match checker. There is another call in `matchWrapper.mk_eqn_info` which seems redundant but really is not; see `Note [Desugaring -XStrict matches in Pmc]`. Fixes #21761.
* Add test for #21476Matthew Pickering2022-12-122-0/+5
| | | | | | | This issues seems to have been fixed since the ticket was made, so let's add a test and move on. Fixes #21476
* testsuite: Mark conc024 fragile on WindowsBryan Richter2022-12-081-1/+1
|
* Fixes around primitive literalsKrzysztof Gogolewski2022-12-084-5/+18
| | | | | | | | | * The SourceText of primitive characters 'a'# did not include the #, unlike for other primitive literals 1#, 1##, 1.0#, 1.0##, "a"#. We can now remove the function pp_st_suffix, which was a hack to add the # back. * Negative primitive literals shouldn't use parentheses, as described in Note [Printing of literals in Core]. Added a testcase to T14681.