summaryrefslogtreecommitdiff
path: root/testsuite/tests
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete code in CoreToStgKrzysztof Gogolewski2022-05-021-1/+0
| | | | | Note [Nullary unboxed tuple] was removed in e9e61f18a548b70693f4. This codepath is tested by T15696_3.
* Add test for T21229Matthew Pickering2022-04-303-0/+26
|
* Revert "Make the specialiser handle polymorphic specialisation"Matthew Pickering2022-04-303-67/+12
| | | | | | | | | | | | | This reverts commit ef0135934fe32da5b5bb730dbce74262e23e72e8. See ticket #21229 ------------------------- Metric Decrease: T15164 Metric Increase: T13056 -------------------------
* Convert More Diagnostics (#20116)Ben Gamari2022-04-309-15/+15
| | | | | Replaces uses of `TcRnUnknownMessage` with proper diagnostics constructors.
* Make mkFunCo take AnonArgFlags into accountRyan Scott2022-04-303-0/+16
| | | | | | | | | | | | | | | | | | | | | | 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.
* testsuite: Normalise package versions in UnusedPackages testMatthew Pickering2022-04-291-1/+4
|
* Fix unification of ConcreteTvs, removing IsRefl#sheaf2022-04-2850-272/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 -------------------------
* Bump process submoduleBen Gamari2022-04-281-1/+1
|
* testsuite: Add performance test for #14766wip/T14766-testBen Gamari2022-04-282-0/+31
| | | | This distills the essence of the Sigs.hs program found in the ticket.
* Mark GHC.Prim.PtrEq as Unsafesheaf2022-04-273-0/+13
| | | | | | | This module exports unsafe pointer equality operations, so we accordingly mark it as Unsafe. Fixes #21433
* Give Cmm files fake ModuleNames which include full filepathMatthew Pickering2022-04-276-0/+43
| | | | | | | This fixes the initialisation functions when using -prof or -finfo-table-map. Fixes #21370
* Enable eventlog support in all ways by defaultBen Gamari2022-04-273-10/+10
| | | | | | | | | | | | | | | | | 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.
* testsuite: Add test for #16476Ben Gamari2022-04-276-0/+45
|
* Ensure that Any is Boxed in FFI imports/exportssheaf2022-04-277-0/+73
| | | | | | | | | | 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
* testsuite: Add testcase for #21141Ben Gamari2022-04-252-0/+27
|
* Improve floated dicts in SpecialiseSimon Peyton Jones2022-04-222-0/+35
| | | | | | | | | | | | | 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.
* decideMonoTyVars: account for CoVars in candidatessheaf2022-04-222-0/+29
| | | | | | | | | | | | 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
* Include the way string in the file name for dump files.Andreas Klebinger2022-04-223-1/+5
| | | | | | 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.
* Fix substitution in bindAuxiliaryDictSimon Peyton Jones2022-04-202-0/+27
| | | | | | | | | | | | | | | | | | | | | 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.
* Add -dkeep-comments flag to keep comments in the parserAlan Zimmerman2022-04-203-0/+297
| | | | | | | | | 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.
* testsuite: Add test for #21390Ben Gamari2022-04-156-0/+44
|
* Only enable PROF_SPIN in DEBUGDylan Yudaken2022-04-151-1/+1
|
* StgLint: Lint constructor applications and strict workers for arity.Andreas Klebinger2022-04-141-2/+2
| | | | | | | This will mean T9208 when run with lint will return a lint error instead of resulting in a panic. Fixes #21117
* Refine warning about defining rules in SAFE modulesMatthew Pickering2022-04-135-5/+6
| | | | | | | | 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
* Specialising through specialised method calls (#19644)Sebastian Graf2022-04-129-16/+990
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Eta reduction based on evaluation context (#21261)Sebastian Graf2022-04-125-0/+181
| | | | | | | | | | | | | | | | | | | 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
* Refactor: simplify lexing of the dotVladislav Zavialov2022-04-091-7/+7
| | | | | | | | | | | | 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.
* Add regression test for #19569Andreas Klebinger2022-04-093-0/+53
|
* Add tests for several trace functions.Philip Hazelden2022-04-092-0/+4
|
* Drop the app invariantghc-9.5-startJoachim Breitner2022-04-096-17/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Disallow (->) as a data constructor name (#16999)Vladislav Zavialov2022-04-083-0/+9
| | | | | | | | | | | | | | 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.
* Docs: datacon eta-expansion, rep-poly checkssheaf2022-04-083-0/+20
| | | | | | | | | | | | | | | | | | | 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.
* HsUniToken for :: in GADT constructors (#19623)Vladislav Zavialov2022-04-086-11/+61
| | | | | | One more step towards the new design of EPA. Updates the haddock submodule.
* Add flag -fprof-manual which controls if GHC should honour manual cost centres.Andreas Klebinger2022-04-084-0/+46
| | | | | | | This allows disabling of manual control centres in code a user doesn't control like libraries. Fixes #18867
* Merge remote-tracking branch 'origin/master'Ben Gamari2022-04-0825-35/+743
|\
| * Reject illegal quote mark in data con declarations (#17865)Vladislav Zavialov2022-04-082-2/+22
| | | | | | | | | | | | * Non-fatal (i.e. recoverable) parse error * Checking infix constructors * Extended the regression test
| * Correctly report SrcLoc of redundant constraintssheaf2022-04-083-0/+11
| | | | | | | | | | | | | | | | | | 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
| * testsuite: Lint RTS #includesBen Gamari2022-04-083-1/+99
| | | | | | | | | | | | | | | | | | | | | | 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.
| * Add test for #21338sheaf2022-04-083-0/+74
| | | | | | | | | | | | | | | | 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.
| * Fix the free-var test in validDerivPredSimon Peyton Jones2022-04-073-0/+32
| | | | | | | | | | | | | | | | | | | | 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>
| * Rename [] to List (#21294)Vladislav Zavialov2022-04-0710-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Use prepareBinding in tryCastWorkerWrapperSimon Peyton Jones2022-04-072-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * EPA: handling of con_bndrs in mkGadtDeclAlan Zimmerman2022-04-072-19/+570
| | | | | | | | | | | | Get rid of unnnecessary case clause that always matched. Closes #20558
| |
| \
| \
| \
*---. \ Merge branches 'wip/windows-high-codegen', 'wip/windows-high-linker', ↵Ben Gamari2022-04-0730-109/+227
|\ \ \ \ | |_|_|/ |/| | | | | | | 'wip/windows-clang-2' and 'wip/lint-rts-includes' into wip/windows-clang-join
| | | * testsuite: Lint RTS #includeswip/lint-rts-includesBen Gamari2022-04-063-1/+99
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * testsuite: Mark T9405 as broken on WindowsBen Gamari2022-04-071-1/+1
| | | | | | | | | | | | Due to #21361.
| | * testsuite: Mark linker unloading tests as broken on WindowsBen Gamari2022-04-072-0/+2
| | | | | | | | | | | | | | | | | | Due to #20354. We will need to investigate this prior the release.
| | * testsuite: Mark T20918 as broken on WindowsBen Gamari2022-04-071-4/+5
| | | | | | | | | | | | Our toolchain on Windows doesn't currently have Windows support.
| | * testsuite: Update expected output from T5435 tests on WindowsBen Gamari2022-04-072-1/+3
| | | | | | | | | | | | | | | 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.
| | * testsuite: Fix exit code of bounds checking tests on WindowsBen Gamari2022-04-071-1/+1
| | | | | | | | | | | | `abort` exits with 255, not 134, on Windows.