diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-22 16:28:50 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-22 16:35:39 +0000 |
commit | 575a98e4d245c1e60526ed6d6711d96cea08e9d2 (patch) | |
tree | 34b4945dd5648a47c43d345b787ad151877b7f0b /testsuite/tests | |
parent | 01b0461e923788e825392d55d625f70c36ca3c20 (diff) | |
download | haskell-575a98e4d245c1e60526ed6d6711d96cea08e9d2.tar.gz |
Refactor named wildcards (again)
Michal's work on #10982, #11098, refactored the handling of named
wildcards by making them more like ordinary type variables.
This patch takes the same idea to its logical conclusion, resulting
in a much tidier, tighter implementation.
Read Note [The wildcard story for types] in HsTypes.
Changes:
* Named wildcards are ordinary type variables, throughout
* HsType no longer has a data constructor for named wildcards
(was NamedWildCard in HsWildCardInfo). Named wildcards are
simply HsTyVars
* Similarly named wildcards disappear from Template Haskell
* I refactored RnTypes to avoid polluting LocalRdrEnv with something
as narrow as named wildcards. Instead the named wildcard set is
carried in RnTyKiEnv.
There is a submodule update for Haddock.
Diffstat (limited to 'testsuite/tests')
5 files changed, 19 insertions, 13 deletions
diff --git a/testsuite/tests/ghci/scripts/T11098.stdout b/testsuite/tests/ghci/scripts/T11098.stdout index 27ddd486ca..2b86289e18 100644 --- a/testsuite/tests/ghci/scripts/T11098.stdout +++ b/testsuite/tests/ghci/scripts/T11098.stdout @@ -1,3 +1,3 @@ -[SigD foo_1 (ForallT [PlainTV a_0] [] (AppT (AppT ArrowT (VarT a_0)) (VarT a_0))),FunD foo_1 [Clause [VarP x_2] (NormalB (VarE x_2)) []]]
-"[SigD foo_ (AppT (AppT ArrowT (WildCardT (Just _a_))) (WildCardT (Just _a_))),FunD foo_ [Clause [VarP x_] (NormalB (VarE x_)) []]]"
-[SigD foo_6 (ForallT [PlainTV _a_5] [] (AppT (AppT ArrowT (VarT _a_5)) (VarT _a_5))),FunD foo_6 [Clause [VarP x_7] (NormalB (VarE x_7)) []]]
+[SigD foo_1 (ForallT [PlainTV a_0] [] (AppT (AppT ArrowT (VarT a_0)) (VarT a_0))),FunD foo_1 [Clause [VarP x_2] (NormalB (VarE x_2)) []]] +"[SigD foo_ (AppT (AppT ArrowT (VarT _a_)) (VarT _a_)),FunD foo_ [Clause [VarP x_] (NormalB (VarE x_)) []]]" +[SigD foo_6 (ForallT [PlainTV _a_5] [] (AppT (AppT ArrowT (VarT _a_5)) (VarT _a_5))),FunD foo_6 [Clause [VarP x_7] (NormalB (VarE x_7)) []]] diff --git a/testsuite/tests/partial-sigs/should_compile/Splices.hs b/testsuite/tests/partial-sigs/should_compile/Splices.hs index 9202c18995..c877248e88 100644 --- a/testsuite/tests/partial-sigs/should_compile/Splices.hs +++ b/testsuite/tests/partial-sigs/should_compile/Splices.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE NamedWildCards #-} +{-# LANGUAGE TemplateHaskell, NamedWildCards #-} + module Splices where import Language.Haskell.TH diff --git a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.hs b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.hs index 21e599dcf6..8a5abb3085 100644 --- a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.hs +++ b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE TemplateHaskell, PartialTypeSignatures, NamedWildCards #-} + module SplicesUsed where import Splices diff --git a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.hs b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.hs index 28bb8362ce..c9a00f33cc 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.hs +++ b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE PartialTypeSignatures, NamedWildCards #-} +{-# LANGUAGE ConstraintKinds, PartialTypeSignatures, NamedWildCards #-} module NamedExtraConstraintsWildcard where foo :: (Eq a, _a) => a -> a diff --git a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr index 47e9b99135..bb1a481a1e 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr @@ -1,5 +1,11 @@ -
-NamedExtraConstraintsWildcard.hs:4:15: error:
- Named wildcard ‘_a’ not allowed as an extra-contraint
- Use an anonymous wildcard instead
- in the type signature for ‘foo’
+ +NamedExtraConstraintsWildcard.hs:5:1: error: + • Could not deduce: t0 + from the context: (Eq a, t) + bound by the inferred type for ‘foo’: + (Eq a, t) => a -> a + at NamedExtraConstraintsWildcard.hs:5:1-15 + • In the ambiguity check for the inferred type for ‘foo’ + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + When checking the inferred type + foo :: forall a (t :: Constraint). (Eq a, t) => a -> a |