summaryrefslogtreecommitdiff
path: root/testsuite/tests
Commit message (Collapse)AuthorAgeFilesLines
* Kill Type pretty-printerBen Gamari2016-11-1316-43/+42
| | | | | | | | | | | | | | | | | | | | | | Here we consolidate the pretty-printing logic for types in IfaceType. We need IfaceType regardless and the printer for Type can be implemented in terms of that for IfaceType. See #11660. Note that this is very much a work-in-progress. Namely I still have yet to ponder how to ease the hs-boot file situation, still need to rip out more dead code, need to move some of the special cases for, e.g., `*` to the IfaceType printer, and need to get it to validate. That being said, it comes close to validating as-is. Test Plan: Validate Reviewers: goldfire, austin Subscribers: goldfire, thomie, simonpj Differential Revision: https://phabricator.haskell.org/D2528 GHC Trac Issues: #11660
* Make default output less verbose (source/object paths)Sylvain HENRY2016-11-11167-608/+608
| | | | | | | | | | | | Reviewers: simonmar, mpickering, austin, bgamari Reviewed By: bgamari Subscribers: mpickering, nomeata, thomie Differential Revision: https://phabricator.haskell.org/D2679 GHC Trac Issues: #12807
* testsuite: Lower allocations for T876Ben Gamari2016-11-111-1/+2
| | | | | | If only we knew why... [skip-ci]
* Prevent GND from inferring an instance context for method-less classesRyan Scott2016-11-108-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `GeneralizedNewtypeDeriving` is used with a type class that has no methods, it will generate a redundant context, and as a result, it can trigger warnings when compiled with `-Wredundant-constraints`. This is a simple change in behavior to check beforehand if a class has methods when deriving it with GND, and if it has no methods, avoid inferring the redundant context. Beware that the test for #6088, which used to be expected to fail, now compiles without issue since it doesn't infer a problematic instance context. Thanks to Simon Peyton Jones for doing the necessary refactoring in f05d685ae05ec293083f2fa7ec7ba057fbe64869. Fixes #12814. Test Plan: ./validate Reviewers: goldfire, rwbarton, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2692 GHC Trac Issues: #12814
* testsuite: Update allocation numbers for T5631Ben Gamari2016-11-101-1/+3
|
* Fix hs_try_putmvar003 (#12800)Simon Marlow2016-11-071-1/+1
| | | | | | | | | | | | | | | | | | | Summary: There was a race condition on some shared data when creating the callback thread. I couldn't repro the issue without inserting a dummy usleep(100), but it's definitely a bug. Test Plan: validate Reviewers: bgamari, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2678 GHC Trac Issues: #12800
* Allow GeneralizedNewtypeDeriving for classes with associated type familiesRyan Scott2016-11-0615-16/+146
| | | | | | | | | | | | | | | | | | | | | | Summary: This implements the ability to derive associated type family instances for newtypes automatically using `GeneralizedNewtypeDeriving`. Refer to the users' guide additions for how this works; I essentially follow the pattern laid out in https://ghc.haskell.org/trac/ghc/ticket/8165#comment:18. Fixes #2721 and #8165. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2636 GHC Trac Issues: #2721, #8165
* Stop -dno-debug-output suppressing -ddump-tc-traceMatthew Pickering2016-11-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: The user manual states that -dno-debug-output should suppress *unsolicited* debugging output which essentially amounts to calls to `pprTrace`. Before I unified the interface of `traceTc` and `traceRn`, the flag suppressed calls to `traceTc` but not to `traceRn` or any other tracing function already controlled by a flag. Thus, in order to make the behaviour more uniform, it seemed best to remove this one special case. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2628 GHC Trac Issues: #12691
* Handle types w/ type variables in signatures inside patterns (DsMeta)Mikhail Vorozhtsov2016-11-0510-16/+95
| | | | | | | | | | | | | | | | | | The comment indicated that scoping of type variables was a large problem but Simon fixed it in e21e13fb52b99b14770cc5857df57bbcc9c85102. Thus, we can implement repP for signatures very easily in the usual way now. Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2490 GHC Trac Issues: #12164
* Take account of injectivity when doing fundepsSimon Peyton Jones2016-11-043-0/+19
| | | | | | This fixes Trac #12803. Yikes! See Note [Care with type functions].
* API Annotations: make all ModuleName LocatedAlan Zimmerman2016-11-035-15/+7
| | | | | | | | | | | | | | | | | | Summary: This also changes the backpack Renaming type to use a Maybe for the renameTo field, to more accurately reflect the parsed source. Updates haddock submodule to match AST changes Test Plan: ./validate Reviewers: ezyang, bgamari, austin Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2670
* Add test for #12788Ryan Scott2016-11-034-0/+36
| | | | | Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's add a test to make sure it stays fixed.
* testsuite: Update T10858 allocationsBen Gamari2016-11-021-1/+1
|
* Add testcase for #12757Ben Gamari2016-11-023-0/+33
| | | | | | | | | | | | Test Plan: Validate, expected to fail Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2665 GHC Trac Issues: #12757
* Fix Trac #12797: approximateWCSimon Peyton Jones2016-11-022-0/+16
| | | | | This patch makes approximateWC a bit more gung-ho when called from the defaulting code. See Note [ApproximateWC], item (1).
* Have static pointers work with -fno-full-laziness.Facundo Domínguez2016-11-013-0/+44
| | | | | | | | | | | | | | | | Summary: Before this patch, static pointers wouldn't be floated to the top-level. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Subscribers: mboes, thomie Differential Revision: https://phabricator.haskell.org/D2662 GHC Trac Issues: #11656
* Align GHCi's library search order more closely with LDsTamar Christina2016-10-316-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Given a static library and an import library in the same folder. e.g. ``` libfoo.a libfoo.dll.a ``` running `ghci -lfoo` we should prefer the import library `libfoo.dll.a` over `libfoo.a` because we prefer having to just load the DLL. And not having to do any linking. This also more closely emulated the behaviour of LD, which has a search order of ``` libxxx.dll.a xxx.dll.a libxxx.a cygxxx.dll (*) libxxx.dll xxx.dll ``` Test Plan: ./validate Reviewers: RyanGlScott, austin, hvr, bgamari, erikd, simonmar Reviewed By: RyanGlScott Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2651 GHC Trac Issues: #12771
* Typos in commentsGabor Greif2016-10-313-9/+9
|
* Add test for #12732Ryan Scott2016-10-283-0/+13
|
* Minor doc addition as requested in #12774.Edward Z. Yang2016-10-271-0/+3
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Allow levity-polymorpic arrowsSimon Peyton Jones2016-10-273-0/+47
| | | | | | | This cures Trac #12668 (and cures the Lint errors you get from Trac #12718). The idea is explained in Note [Levity polymorphism], in Kind.hs
* Refine ASSERT in buildPatSyn for the nullary case.Matthew Pickering2016-10-263-0/+13
| | | | | | | | | | | | | | | | | For a nullary pattern synonym we add an extra void argument to the matcher in order to preserve laziness. The check in buildPatSyn wasn't aware of this special case which was causing the assertion to fail. Reviewers: austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2624 GHC Trac Issues: #12746
* Make traceRn behave more like traceTcMatthew Pickering2016-10-261-3/+6
| | | | | | | | | | | | Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2586 GHC Trac Issues: #12617
* Fundeps work even for unary type classesSimon Peyton Jones2016-10-264-54/+34
| | | | | | | | | | | | The functional-dependency improvement functions, improveFromAnother improveFromInstEnv had a side-condition that said the type class has to have at least two arguments. But not so, as Trac #12763 shows: class C a | -> a where ... is perfectly legal, albeit a bit of a corner case.
* testsuite: Bump peak_megabytes_allocated for T3064Ben Gamari2016-10-251-1/+2
|
* Test Trac #12081Simon Peyton Jones2016-10-243-0/+17
|
* Test Trac #12174Simon Peyton Jones2016-10-243-0/+17
|
* Take account of kinds in promoteTcTypeSimon Peyton Jones2016-10-245-19/+27
| | | | | | | | | One of the ASSERT failures in Trac #12762, namely the one for T4439, showed that I had not dealt correctly with promoting the kind of a type in promoteTcType. Happily I could fix this by simplifying InferRes (eliminating the ir_kind field), so things get better. And the ASSERT is fixed.
* Prioritise class-level equality costraintsSimon Peyton Jones2016-10-244-0/+207
| | | | | | | | | | | | | This patch fixes Trac #12734 by prioritising the class-level variants of equality constraints, namely (a~b) and (a~~b). See comment:10 of Trac #12734 for a description of what went wrong, and Note [Prioritise class equalities] in TcSMonad. The fix is still not great, but it's a definite step forward, and cures the particular problem. Worth merging to 8.0.
* Add -Wcpp-undef warning flagErik de Castro Lopo2016-10-224-1/+24
| | | | | | | | | | | | | | | | | | | | When enabled, this new warning flag passes `-Wundef` to the C pre-processor which causes the pre-processor to warn on uses of the `#if` directive on undefined identifiers. It is not currently enabled in any of the standard warning groups. Test Plan: Make sure the two tests pass on all major platforms. Reviewers: hvr, carter, Phyx, bgamari, austin Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2626 GHC Trac Issues: #12752
* Skip T5611 on OSX as it fails non-deterministically.Matthew Pickering2016-10-221-1/+2
| | | | | | | | | | Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2622 GHC Trac Issues: #12751
* Fix failure in setnumcapabilities001 (#12728)Simon Marlow2016-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The value of enabled_capabilities can change across a call to requestSync(), and we were erroneously using an old value, causing things to go wrong later. It manifested as an assertion failure, I'm not sure whether there are worse consequences or not, but we should get this fix into 8.0.2 anyway. The failure didn't happen for me because it only shows up on machines with fewer than 4 processors, due to the new logic to enable -qn automatically. I've bumped the test parameter 8 to make it more likely to exercise that code. Test Plan: Ran setnumcapabilities001 many times Reviewers: niteria, austin, erikd, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2617 GHC Trac Issues: #12728
* Accept 20% dedgradation in Trac #5030 compile timeSimon Peyton Jones2016-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | In commit 31621b12 * A collection of type-inference refactorings. I fixed a bug in the on-the-fly unifier. Usually the on-the-fly unifier (TcUnify) defers type function applications to the constraint solver. But in one situation it inconsistently did not defer, so a unification happened without reducing a type function. By a fluke this makes T5030 (specifcially the definition of cnst) much better. It turns out that consistently non-deferring type functions makes the test for #3064 go bad. So somehow the current, inconsistent situation was an accidental sweet spot. But it's a horrible sweet spot, relying on what was essentially a bug. So I've accepted the worsening (it's an exotic case), and opened #12724 to deal with the underlying cause.
* A collection of type-inference refactorings.Simon Peyton Jones2016-10-2155-225/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does a raft of useful tidy-ups in the type checker. I've been meaning to do this for some time, and finally made time to do it en route to ICFP. 1. Modify TcType.ExpType to make a distinct data type, InferResult for the Infer case, and consequential refactoring. 2. Define a new function TcUnify.fillInferResult, to fill in an InferResult. It uses TcMType.promoteTcType to promote the type to the level of the InferResult. See TcMType Note [Promoting a type] This refactoring is in preparation for an improvement to typechecking pattern bindings, coming next. I flirted with an elaborate scheme to give better higher rank inference, but it was just too complicated. See TcMType Note [Promotion and higher rank types] 3. Add to InferResult a new field ir_inst :: Bool to say whether or not the type used to fill in the InferResult should be deeply instantiated. See TcUnify Note [Deep instantiation of InferResult]. 4. Add a TcLevel to SkolemTvs. This will be useful generally - it's a fast way to see if the type variable escapes when floating (not used yet) - it provides a good consistency check when updating a unification variable (TcMType.writeMetaTyVarRef, the level_check_ok check) I originally had another reason (related to the flirting in (2), but I left it in because it seems like a step in the right direction. 5. Reduce and simplify the plethora of uExpType, tcSubType and related functions in TcUnify. It was such an opaque mess and it's still not great, but it's better. 6. Simplify the uo_expected field of TypeEqOrigin. Richard had generatlised it to a ExpType, but it was almost always a Check type. Now it's back to being a plain TcType which is much, much easier. 7. Improve error messages by refraining from skolemisation when it's clear that there's an error: see TcUnify Note [Don't skolemise unnecessarily] 8. Type.isPiTy and isForAllTy seem to be missing a coreView check, so I added it 9. Kill off tcs_used_tcvs. Its purpose is to track the givens used by wanted constraints. For dictionaries etc we do that via the free vars of the /bindings/ in the implication constraint ic_binds. But for coercions we just do update-in-place in the type, rather than generating a binding. So we need something analogous to bindings, to track what coercions we have added. That was the purpose of tcs_used_tcvs. But it only worked for a /single/ iteration, whereas we may have multiple iterations of solving an implication. Look at (the old) 'setImplicationStatus'. If the constraint is unsolved, it just drops the used_tvs on the floor. If it becomes solved next time round, we'll pick up coercions used in that round, but ignore ones used in the first round. There was an outright bug. Result = (potentialy) bogus unused-constraint errors. Constructing a case where this actually happens seems quite trick so I did not do so. Solution: expand EvBindsVar to include the (free vars of the) coercions, so that the coercions are tracked in essentially the same way as the bindings. This turned out to be much simpler. Less code, more correct. 10. Make the ic_binds field in an implication have type ic_binds :: EvBindsVar instead of (as previously) ic_binds :: Maybe EvBindsVar This is notably simpler, and faster to use -- less testing of the Maybe. But in the occaional situation where we don't have anywhere to put the bindings, the belt-and-braces error check is lost. So I put it back as an ASSERT in 'setImplicationStatus' (see the use of 'termEvidenceAllowed') All these changes led to quite bit of error message wibbling
* Test Trac #12507Simon Peyton Jones2016-10-212-0/+17
| | | | | | This is now working apparently. It relates to when a polymorphic function gets instantiated, under some implicit paramter bindings.
* Refactor typechecking of pattern bindingsSimon Peyton Jones2016-10-213-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a regression introduced, post 8.0.1, by this major commit: commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Sat Jun 11 23:49:27 2016 +0100 Improve typechecking of let-bindings This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. I didn't get the typechecking of pattern bindings right, leading to Trac #12427. In fixing this I found that this program doesn't work: data T where T :: a -> ((forall b. [b]->[b]) -> Int) -> T h1 y = case y of T _ v -> v Works in 7.10, but not in 8.0.1. There's a happy ending. I found a way to fix this, and improve pattern bindings too. Not only does this fix #12427, but it also allows In particular,we now can accept data T where MkT :: a -> Int -> T ... let { MkT _ q = t } in ... Previously this elicited "my head exploded" but it's really fine since q::Int. The approach is described in detail in TcBinds Note [Typechecking pattern bindings] Super cool. And not even a big patch!
* Mark previously failing backpack tests as passing, with correct output.Edward Z. Yang2016-10-2011-35/+119
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Support constraint synonym implementations of abstract classes.Edward Z. Yang2016-10-205-0/+91
| | | | | | | | | | | | | | Summary: Test Plan: validate Reviewers: goldfire, simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2595 GHC Trac Issues: #12679
* New story for abstract data types in hsig files.Edward Z. Yang2016-10-2017-1/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the old implementation of hsig files, we directly reused the implementation of abstract data types from hs-boot files. However, this was WRONG. Consider the following program (an abridged version of bkpfail24): {-# LANGUAGE GADTs #-} unit p where signature H1 where data T signature H2 where data T module M where import qualified H1 import qualified H2 f :: H1.T ~ H2.T => a -> b f x = x Prior to this patch, M was accepted, because the type inference engine concluded that H1.T ~ H2.T does not hold (indeed, *presently*, it does not). However, if we subsequently instantiate p with the same module for H1 and H2, H1.T ~ H2.T does hold! Unsound. The key is that abstract types from signatures need to be treated like *skolem variables*, since you can interpret a Backpack unit as a record which is universally quantified over all of its abstract types, as such (with some fake syntax for structural records): p :: forall t1 t2. { f :: t1 ~ t2 => a -> b } p = { f = \x -> x } -- ill-typed Clearly t1 ~ t2 is not solvable inside p, and also clearly it could be true at some point in the future, so we better not treat the lambda expression after f as inaccessible. The fix seems to be simple: do NOT eagerly fail when trying to simplify the given constraints. Instead, treat H1.T ~ H2.T as an irreducible constraint (rather than an insoluble one); this causes GHC to treat f as accessible--now we will typecheck the rest of the function (and correctly fail). Per the OutsideIn(X) paper, it's always sound to fail less when simplifying givens. We do NOT apply this fix to hs-boot files, where abstract data is also guaranteed to be nominally distinct (since it can't be implemented via a reexport or a type synonym.) This is a somewhat unnatural state of affairs (there's no way to really interpret this in Haskell land) but no reason to change behavior. I deleted "representationally distinct abstract data", which is never used anywhere in GHC. In the process of constructing this fix, I also realized our implementation of type synonym matching against abstract data was not sufficiently restrictive. In order for a type synonym T to be well-formed type, it must be a nullary synonym (i.e., type T :: * -> *, not type T a = ...). Furthermore, since we use abstract data when defining instances, they must not have any type family applications. More details in #12680. This probably deserves some sort of short paper report. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: goldfire, simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2594
* Test for newtype with unboxed argumentSimon Peyton Jones2016-10-194-6/+26
| | | | | | | | | Newtypes cannot (currently) have an unboxed argument type. But Trac #12729 showed that this was only being checked for newtypes in H98 syntax; in GADT snytax they were let through. This patch moves the test to checkValidDataCon, where it properly belongs.
* Compute export hash based on ALL transitive orphan modules.Edward Z. Yang2016-10-1813-0/+88
| | | | | | | | | | | | | | | | | | | Previously we pruned out orphan modules from external packages but this was wrong. Fixes #12733 (which has more discussion.) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2610 GHC Trac Issues: #12733
* fixup! Add option to not retain CAFs to the linker APISimon Marlow2016-10-181-1/+1
|
* Track dep_finsts in exports hash, as it affects downstream deps.Edward Z. Yang2016-10-178-0/+53
| | | | | | | | | | | | | | | | | | | | Summary: I also added some more comments about the orphan and family instance hashing business. Fixes #12723. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2607 GHC Trac Issues: #12723
* testsuite: Mark T7037 as broken on WindowsBen Gamari2016-10-171-1/+2
| | | | Due to #12725.
* testsuite: Eliminate unnecessary compile_timeout_multiplierBen Gamari2016-10-171-1/+1
| | | | | | | | | | | | | | | | tc266 was failing intermittently on Windows due to a very small compile_timeout_multiplier. This test was added in e907e1f12f4dedc0ec13c7a501c8810bcfc03583 which doesn't appear to have any timng dependence, so I see no reason to retain the multiplier at all. Test Plan: Validate Reviewers: ezyang, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2601
* testsuite: Mark T9405 as broken on WindowsBen Gamari2016-10-172-2/+4
| | | | There seems to be a runtime system bug here, as described in #12714.
* testsuite: Mark T10858 as broken on WindowsBen Gamari2016-10-171-1/+2
| | | | | | | | Strangely the allocation numbers on Windows differ significantly from those on Linux. Usually I would just update the number, but I would really like to understand why this is the case. This is a rather large deviation in the compilation of a program which really shouldn't have any appreciable platform dependence.
* testsuite: Mark break011 as brokenBen Gamari2016-10-171-1/+4
| | | | See #12712.
* Comments onlySimon Peyton Jones2016-10-171-0/+13
|
* Add more variants of T3064 (in comments)Simon Peyton Jones2016-10-171-10/+13
|