summaryrefslogtreecommitdiff
path: root/testsuite
Commit message (Collapse)AuthorAgeFilesLines
* Fix #16517 by bumping the TcLevel for method sigswip/backport-MR951Richard Eisenberg2019-06-2026-406/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were actually two bugs fixed here: 1. candidateQTyVarsOfType needs to be careful that it does not try to zap metavariables from an outer scope as "naughty" quantification candidates. This commit adds a simple check to avoid doing so. 2. We weren't bumping the TcLevel in kcHsKindSig, which was used only for class method sigs. This mistake led to the acceptance of class C a where meth :: forall k. Proxy (a :: k) -> () Note that k is *locally* quantified. This patch fixes the problem by using tcClassSigType, which correctly bumps the level. It's a bit inefficient because tcClassSigType does other work, too, but it would be tedious to repeat much of the code there with only a few changes. This version works well and is simple. And, while updating comments, etc., I noticed that tcRnType was missing a pushTcLevel, leading to #16767, which this patch also fixes, by bumping the level. In the refactoring here, I also use solveEqualities. This initially failed ghci/scripts/T15415, but that was fixed by teaching solveEqualities to respect -XPartialTypeSignatures. This patch also cleans up some Notes around error generation that came up in conversation. Test case: typecheck/should_fail/T16517, ghci/scripts/T16767 (cherry picked from commit a22e51ea6f7a046c87d57ce30d143eef6abee9ff)
* testsuite: Mark threadstatus-T9333 as fragile in ghci waywip/backport-fragileBen Gamari2019-06-111-1/+1
| | | | | | As noted in #16555. (cherry picked from commit 64b1684da09ddb3dc480bd0370adc7b002657a39)
* testsuite: Fix fragile_for test modifierBen Gamari2019-06-111-3/+3
| | | | (cherry picked from commit 658199cce0aabeed77f3bbbbde6abc0c5c3cc83d)
* testsuite: Mark heapprof001 as fragile on all platformsBen Gamari2019-06-111-1/+1
| | | | | | See #15382. (cherry picked from commit 23fc615679072a6fa433460a92f597af2ae388b2)
* testsuite: Mark heapprof001 as fragile on i386Ben Gamari2019-06-111-1/+1
| | | | (cherry picked from commit 910185a3eb5fd2148e42d39f6374ab03d098b682)
* testsuite: Introduce fragile modifierBen Gamari2019-06-111-0/+24
| | | | | | | | | | | | Now since we have been a bit more stringent in testsuite cleanliness we have been marking a lot of tests as fragile using the `skip` modifier. However, this unfortunately means that we lose the association with the ticket number documenting the fragility. Here we introduce `fragile` and `fragile_for` to retain this information. (cherry picked from commit 4ca271d1880a6f4c5f49869de7f1920a2073adb6)
* Bump Cabal submoduleBen Gamari2019-06-091-3/+2
|
* Merge branch 'wip/8-8-ghci' of gitlab.haskell.org:ghc/ghc into ↵Ben Gamari2019-06-046-6/+1
|\ | | | | | | wip/ghc-8.8-merges
| * Have GHCi use object code for UnboxedTuples modules #15454Michael Sloan2019-06-036-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | The idea is to automatically enable -fobject-code for modules that use UnboxedTuples, along with all the modules they depend on. When looking into how to solve this, I was pleased to find that there was already highly similar logic for enabling code generation when -fno-code is specified but TemplateHaskell is used. The state before this patch was that if you used unboxed tuples then you had to enable `-fobject-code` globally rather than on a per module basis.
* | Merge branch 'hie-backports-8.8' of https://gitlab.haskell.org/DanielG/ghc ↵Ben Gamari2019-06-0410-1/+478
|\ \ | | | | | | | | | into wip/ghc-8.8-merges
| * | PartialDownsweep: Add test for import errorsDaniel Gröber2019-06-032-0/+14
| | |
| * | Catch preprocessor errors in downsweepDaniel Gröber2019-06-035-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the way preprocessor failures are presented to the user. Previously the user would simply get an unlocated message on stderr such as: `gcc' failed in phase `C pre-processor'. (Exit code: 1) Now at the problematic source file is mentioned: A.hs:1:1: error: `gcc' failed in phase `C pre-processor'. (Exit code: 1) This also makes live easier for GHC API clients as the preprocessor error is now thrown as a SourceError exception.
| * | Make downsweep return all errors per-module instead of throwing someDaniel Gröber2019-06-032-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | This enables API clients to handle such errors instead of immideately crashing in the face of some kinds of user errors, which is arguably quite bad UX. Fixes #10887
| * | Refactor summarise{File,Module} to extract checkSummaryTimestampDaniel Gröber2019-06-033-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a slight change of behaviour in the interrest of keeping the code simple: Previously summariseModule would not call addHomeModuleToFinder for summaries that are being re-used but now we do. We're forced to to do this in summariseFile because the file being summarised might not even be on the regular search path! So if GHC is to find it at all we have to pre-populate the cache with its location. For modules however the finder cache is really just a cache so we don't have to pre-populate it with the module's location. As straightforward as that seems I did almost manage to introduce a bug (or so I thought) because the call to addHomeModuleToFinder I copied from summariseFile used to use `ms_location old_summary` instead of the `location` argument to checkSummaryTimestamp. If this call were to overwrite the existing entry in the cache that would have resulted in us using the old location of any module even if it was, say, moved to a different directory between calls to 'depanal'. However it turns out the cache just ignores the location if the module is already in the cache. Since summariseModule has to search for the module, which has the side effect of populating the cache, everything would have been fine either way. Well I'm adding a test for this anyways: tests/depanal/OldModLocation.hs.
| * | Add failing test for #10887Daniel Gröber2019-06-033-0/+143
| | |
| * | downsweep: Allow TargetFile not to exist when a buffer is givenDaniel Gröber2019-06-032-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently 'getRootSummary' will fail with an exception if a 'TargetFile' is given but it does not exist even if an input buffer is passed along for this target. In this case it is not necessary for the file to exist since the buffer will be used as input for the compilation pipeline instead of the file anyways.
| * | Allow using tagetContents for modules needing preprocessingDaniel Gröber2019-06-033-0/+199
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows GHC API clients, most notably tooling such as Haskell-IDE-Engine, to pass unsaved files to GHC more easily. Currently when targetContents is used but the module requires preprocessing 'preprocessFile' simply throws an error because the pipeline does not support passing a buffer. This change extends `runPipeline` to allow passing the input buffer into the pipeline. Before proceeding with the actual pipeline loop the input buffer is immediately written out to a new tempfile. I briefly considered refactoring the pipeline at large to pass around in-memory buffers instead of files, but this seems needlessly complicated since no pipeline stages other than Hsc could really support this at the moment.
* | Merge remote-tracking branch 'osa1/port_16449_ghc_8_8' into wip/ghc-8.8-mergesBen Gamari2019-06-045-0/+21
|\ \
| * | Fix rewriting invalid shifts to errorsÖmer Sinan Ağacan2019-06-035-0/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #16449. 5341edf3 removed a code in rewrite rules for bit shifts, which broke the "silly shift guard", causing generating invalid bit shifts or heap overflow in compile time while trying to evaluate those invalid bit shifts. The "guard" is explained in Note [Guarding against silly shifts] in PrelRules.hs. More specifically, this was the breaking change: --- a/compiler/prelude/PrelRules.hs +++ b/compiler/prelude/PrelRules.hs @@ -474,12 +474,11 @@ shiftRule shift_op ; case e1 of _ | shift_len == 0 -> return e1 - | shift_len < 0 || wordSizeInBits dflags < shift_len - -> return (mkRuntimeErrorApp rUNTIME_ERROR_ID wordPrimTy - ("Bad shift length" ++ show shift_len)) This patch reverts this change. Two new tests added: - T16449_1: The original reproducer in #16449. This was previously casing a heap overflow in compile time when CmmOpt tries to evaluate the large (invalid) bit shift in compile time, using `Integer` as the result type. Now it builds as expected. We now generate an error for the shift as expected. - T16449_2: Tests code generator for large (invalid) bit shifts.
* | Merge remote-tracking branch 'origin/cherry-pick-43a43a33' into ↵Ben Gamari2019-06-045-0/+9
|\ \ | | | | | | | | | wip/ghc-8.8-merges
| * | Handle hs-boot files in -Wmissing-home-modules (#16551)cherry-pick-43a43a33Krzysztof Gogolewski2019-06-035-0/+9
| |/ | | | | (cherry picked from commit 43a43a3319d68c1692df6acdf283109cb5c030d8)
* | Merge remote-tracking branch 'osa1/backport_t16066' into wip/ghc-8.8-mergesBen Gamari2019-06-043-0/+31
|\ \
| * | Fix arity type of coerced types in CoreArityÖmer Sinan Ağacan2019-06-033-0/+31
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously if we had f |> co where `f` had arity type `ABot N` and `co` had arity M and M < N, `arityType` would return `ABot M` which is wrong, because `f` is only known to diverge when applied to `N` args, as described in Note [ArityType]: If at = ABot n, then (f x1..xn) definitely diverges. Partial applications to fewer than n args may *or may not* diverge. This caused incorrect eta expansion in the simplifier, causing #16066. We now return `ATop M` for the same expression so the simplifier can't assume partial applications of `f |> co` is divergent. A regression test T16066 is also added.
* | testsuite: Mark concprog001 as fragileBen Gamari2019-06-041-0/+1
|/ | | | Due to #16604.
* Use funPrec, not topPrec, to parenthesize GADT argument typesRyan Scott2019-04-094-0/+14
| | | | A simple oversight. Fixes #16527.
* base: Remove `Monad(fail)` method and reexport `MonadFail(fail)` insteadHerbert Valerio Riedel2019-04-05134-652/+192
| | | | | | As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail Coauthored-by: Ben Gamari <ben@well-typed.com>
* Fix #16219: TemplateHaskell causes indefinite package build errorcherry-pick-d6d735c1Edward Z. Yang2019-04-019-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | It should work to write an indefinite package using TemplateHaskell, so long as all of the actual TH code lives outside of the package. However, cleverness we had to build TH code even when building with -fno-code meant that we attempted to build object code for modules in an indefinite package, even when the signatures were not instantiated. This patch disables said logic in the event that an indefinite package is being typechecked. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: validate Reviewers: simonpj, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #16219 Differential Revision: https://phabricator.haskell.org/D5475 (cherry picked from commit d6d735c1114082b9e9cc1ba7da87c49f52891320)
* Dot/bang operators in export lists (Trac #16339)Vladislav Zavialov2019-03-212-0/+19
| | | | | | | | The dot type operator was handled in the 'tyvarop' parser production, and the bang type operator in 'tyapp'. However, export lists and role annotations use 'oqtycon', so these type operators could not be exported or assigned roles. The fix is to handle them in a lower level production, 'tyconsym'.
* 'forall' always a keyword, plus the dot type operatorVladislav Zavialov2019-03-219-22/+28
|
* Make bkpcabal01 test compatible with new ordering requirements.Edward Z. Yang2019-03-131-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, our test did something like this: 1. Typecheck p 2. Typecheck q (which made use of an instantiated p) 3. Build instantiated p 4. Build instantiated q Cabal previously permitted this, under the reasoning that during typechecking there's no harm in using the instantiated p even if we haven't build it yet; we'll just instantiate it on the fly with p. However, this is not true! If q makes use of a Template Haskell splice from p, we absolutely must have built the instantiated p before we typecheck q, since this typechecking will need to run some splices. Cabal now complains that you haven't done it correctly, which we indeed have not! Reordering so that we do this: 1. Typecheck p 3. Build instantiated p 2. Typecheck q (which made use of an instantiated p) 4. Build instantiated q Fixes the problem. If Cabal had managed the ordering itself, it would have gotten it right. Signed-off-by: Edward Z. Yang <ezyang@fb.com> (cherry picked from commit 6e3e537e419ba8d02dac306d596fba3c1029f123)
* API Annotations: parens anns discarded for `(*)` operatorwip/ghc-8.8-azAlan Zimmerman2019-02-274-0/+48
| | | | | | | | | | | | | | | | | The patch from https://phabricator.haskell.org/D4865 introduces go _ (HsParTy _ (dL->L l (HsStarTy _ isUni))) acc ann fix = do { warnStarBndr l ; let name = mkOccName tcClsName (if isUni then "★" else "*") ; return (cL l (Unqual name), acc, fix, ann) } which discards the parens annotations belonging to the HsParTy. Updates haddock submodule Closes #16265 (cherry picked from commit 5e9888bd9c22a1315a703f638591b50e657317c4)
* API Annotations: AnnAt disconnected for TYPEAPPAlan Zimmerman2019-02-276-2/+115
| | | | | | | | | | | | | | For the code type family F1 (a :: k) (f :: k -> Type) :: Type where F1 @Peano a f = T @Peano f a the API annotation for the first @ is not attached to a SourceSpan in the ParsedSource Closes #16236 (cherry picked from commit cbfc9fcaa33c3b341830962906543dfca1dfedd7)
* API Annotations: more explicit foralls fixupAlan Zimmerman2019-02-274-0/+95
| | | | | | | | | The AnnForall annotations introduced via Phab:D4894 are not always attached to the correct SourceSpan. Closes #16230 (cherry picked from commit be15f7457b98fa0378de7e8146c122757f03c4e9)
* API Annotations: Parens not attached correctly for ClassDeclAlan Zimmerman2019-02-274-19/+35
| | | | | | | | | | | | | The parens around the kinded tyvars should be attached to the class declaration as a whole, they are attached to the tyvar instead, outside the span. An annotation must always be within or after the span it is contained in. Closes #16212 (cherry picked from commit 4bf35da4fccd2a21153a1c19bfa80006e99e02a1)
* check-api-annotations checks for annotation preceding its spanAlan Zimmerman2019-02-2629-38/+216
| | | | | | | | | | | | | | | | | | For an API annotation to be useful, it must not occur before the span it is enclosed in. So, for check-api-annotation output, a line such as ((Test16212.hs:3:22-36,AnnOpenP), [Test16212.hs:3:21]), should be flagged as an error, as the AnnOpenP location of 3:21 precedes its enclosing span of 3:22-26. This patch does this. Closes #16217 (cherry picked from commit 3cf12e6081e7a9f0c3d515de52ffd079186816a5)
* Lexer: Alternate Layout Rule injects actual not virtual bracesAlan Zimmerman2019-02-264-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the alternate layout rule is activated via a pragma, it injects tokens for { and } to make sure that the source is parsed properly. But it injects ITocurly and ITccurly, rather than their virtual counterparts ITvocurly and ITvccurly. This causes problems for ghc-exactprint, which tries to print these. Likewise, any injected ITsemi should have a zero-width SrcSpan. Test case (the existing T13087.hs) {-# LANGUAGE AlternativeLayoutRule #-} {-# LANGUAGE LambdaCase #-} isOne :: Int -> Bool isOne = \case 1 -> True _ -> False main = return () Closes #16279 (cherry picked from commit c1cf2693d6efddeeeb813cd8995a1be136800d17) (cherry picked from commit e0375ba980fd5639d23a29575efb00c30d97c743)
* Revert "Lexer: Alternate Layout Rule injects actual not virtual braces"Ben Gamari2019-02-264-62/+0
| | | | This reverts commit e0375ba980fd5639d23a29575efb00c30d97c743.
* Fix #16188Richard Eisenberg2019-02-2010-27/+222
| | | | | | | | | | | | | | | | There was an awful lot of zipping going on in canDecomposableTyConAppOK, and one of the lists being zipped was too short, causing the result to be too short. Easily fixed. Also fixes #16204 and #16225 test case: typecheck/should_compile/T16188 typecheck/should_compile/T16204[ab] typecheck/should_fail/T16204c typecheck/should_compile/T16225 (cherry picked from commit 4a4ae70f09009c5d32696445a06eacb273f364b5)
* Capture and simplify constraints arising from running typed splicesMatthew Pickering2019-02-203-0/+29
| | | | | | | | | | | | | | | | | This fixes a regression caused by #15471 where splicing in a trivial program such as `[|| return () ||]` would fail as the dictionary for `return` would never get bound in the module containing the splice. Arguably this is symptomatic of a major problem affecting TTH where we serialise renamed asts and then retype check them. The reference to the dictionary should be fully determined at the quote site so that splicing doesn't have to solve any implicits at all. It's a coincidence this works due to coherence but see #15863 and #15865 for examples where things do go very wrong. Fixes #16195 (cherry picked from commit a48753bdbc99cda36890e851950f5b79e1c3b2b2)
* Fix #14729 by making the normaliser homogeneousRichard Eisenberg2019-02-208-0/+91
| | | | | | | | | | | | | | | | | | This ports the fix to #12919 to the normaliser. (#12919 was about the flattener.) Because the fix is involved, this is done by moving the critical piece of code to Coercion, and then calling this from both the flattener and the normaliser. The key bit is: simplifying type families in a type is always a *homogeneous* operation. See #12919 for a discussion of why this is the Right Way to simplify type families. Also fixes #15549. test case: dependent/should_compile/T14729{,kind} typecheck/should_compile/T15549[ab] (cherry picked from commit 2b90356d26b4699227816ad9424e766eccdb6c36)
* Fix #15849 by checking whether there's a do blocknineonine2019-02-205-4/+8
| | | | (cherry picked from commit a08f463bcc9727d91cec4c6e952ad0f5bbc3fbf9)
* testsuite: Always skip T15897Ben Gamari2019-02-201-1/+4
| | | | | | See #16193. (cherry picked from commit f53ef1a72fdebeff19d4a4bd5552d25101c85147)
* Use sigPrec in more places in Convert and HsUtilsRyan Scott2019-02-204-2/+26
| | | | | | | | | | | Trac #16183 was caused by TH conversion (in `Convert`) not properly inserting parentheses around occurrences of explicit signatures where appropriate, such as in applications, function types, and type family equations. Solution: use `parenthesizeHsType sigPrec` in these places. While I was in town, I also updated `nlHsFunTy` to do the same thing. (cherry picked from commit b1e569a54085bf1093b4f858f8c7c739e3be769b)
* Reject oversaturated VKAs in type family equationsRyan Scott2019-02-206-1/+38
| | | | (cherry picked from commit f0cd728fde9bb582930a616cff8d0c5a178c5e14)
* Lexer: Alternate Layout Rule injects actual not virtual bracesAlan Zimmerman2019-02-204-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the alternate layout rule is activated via a pragma, it injects tokens for { and } to make sure that the source is parsed properly. But it injects ITocurly and ITccurly, rather than their virtual counterparts ITvocurly and ITvccurly. This causes problems for ghc-exactprint, which tries to print these. Likewise, any injected ITsemi should have a zero-width SrcSpan. Test case (the existing T13087.hs) {-# LANGUAGE AlternativeLayoutRule #-} {-# LANGUAGE LambdaCase #-} isOne :: Int -> Bool isOne = \case 1 -> True _ -> False main = return () Closes #16279 (cherry picked from commit c1cf2693d6efddeeeb813cd8995a1be136800d17)
* Fix #16287 by checking for more unsaturated synonym argumentsRyan Scott2019-02-203-0/+23
| | | | | | | | | | | | | | | Trac #16287 shows that we were checking for unsaturated type synonym arguments (in `:kind`) when the argument was to a type synonym, but _not_ when the argument was to some other form of type constructor, such as a data type. The solution is to use the machinery that rejects unsaturated type synonym arguments (previously confined to `check_syn_tc_app`) to `check_arg_type`, which checks these other forms of arguments. While I was in town, I cleaned up `check_syn_tc_app` a bit to only invoke `check_arg_type` so as to minimize the number of different code paths that that function could go down. (cherry picked from commit c07e7ecbdfc05429fb6ce84c547c0365d2754db7)
* Test that hsc2hs works with promoted data constructorsAndrew Martin2019-02-203-0/+20
| | | | (cherry picked from commit 79a5afb613235e93bc2c580987595b9c1324db15)
* testsuite: Remove directories that already exist when seeding extra_filesBen Gamari2019-02-201-0/+2
| | | | | Otherwise the testsuite driver crashes when run multiple times with CLEANUP=NO on a test containing such extra_files.
* testsuite: Normalise styleBen Gamari2019-02-201-6/+7
|
* testsuite: Add test for #16104Ben Gamari2019-02-209-0/+77
|