diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-02-25 08:31:33 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-05 03:09:41 -0500 |
commit | 80dfcee61e3bfb67f131cd674f96467e16c0f9d8 (patch) | |
tree | 3b486a446fa687097b66b99dc22424ec929e2aaf /testsuite | |
parent | e6ce17433b75c6c985bffaf1f6fc18d299666ccb (diff) | |
download | haskell-80dfcee61e3bfb67f131cd674f96467e16c0f9d8.tar.gz |
Be more careful when naming TyCon binders
This patch fixes two rather gnarly test cases:
* Trac #16342 (mutual recursion)
See Note [Tricky scoping in generaliseTcTyCon]
* Trac #16221 (shadowing)
See Note [Unification variables need fresh Names]
The main changes are:
* Substantial reworking of TcTyClsDecls.generaliseTcTyCon
This is the big change, and involves the rather tricky
function TcHsSyn.zonkRecTyVarBndrs.
See Note [Inferring kinds for type declarations] and
Note [Tricky scoping in generaliseTcTyCon] for the details.
* bindExplicitTKBndrs_Tv and bindImplicitTKBndrs_Tv both now
allocate /freshly-named/ unification variables. Indeed, more
generally, unification variables are always fresh; see
Note [Unification variables need fresh Names] in TcMType
* Clarify the role of tcTyConScopedTyVars.
See Note [Scoped tyvars in a TcTyCon] in TyCon
As usual, this dragged in some more refactoring:
* Renamed TcMType.zonkTyCoVarBndr to zonkAndSkolemise
* I renamed checkValidTelescope to checkTyConTelescope;
it's only used on TyCons, and indeed takes a TyCon as argument.
* I folded the slightly-mysterious reportFloatingKvs into
checkTyConTelescope. (Previously all its calls immediately
followed a call to checkTyConTelescope.) It makes much more
sense there.
* I inlined some called-once functions to simplify
checkValidTyFamEqn. It's less spaghetti-like now.
* This patch also fixes Trac #16251. I'm not quite sure why #16251
went wrong in the first place, nor how this patch fixes it, but
hey, it's good, and life is short.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/tc141.stderr | 18 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T2688.stderr | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 8aef2e7673..4e29910c21 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -69,7 +69,7 @@ test('T2664a', normal, compile, ['']) test('T2544', normal, compile_fail, ['']) test('T1897b', normal, compile_fail, ['']) test('T5439', normal, compile_fail, ['']) -test('T5515', when(compiler_debugged(), expect_broken(16251)), compile_fail, ['']) +test('T5515', normal, compile_fail, ['']) test('T5934', normal, compile_fail, ['']) test('T6123', normal, compile_fail, ['']) test('ExtraTcsUntch', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index f0cfdefd03..b0d4ef7f25 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -7,22 +7,22 @@ tc141.hs:11:12: error: In a pattern binding: (p :: a, q :: a) = x tc141.hs:11:31: error: - • Couldn't match expected type ‘a2’ with actual type ‘a’ - ‘a2’ is a rigid type variable bound by + • Couldn't match expected type ‘a1’ with actual type ‘b’ + ‘a1’ is a rigid type variable bound by an expression type signature: - forall a2. a2 + forall a1. a1 at tc141.hs:11:34 - ‘a’ is a rigid type variable bound by - the inferred type of f :: (a, a) -> (a1, a) + ‘b’ is a rigid type variable bound by + the inferred type of f :: (b, b) -> (a, b) at tc141.hs:11:1-37 • In the expression: q :: a In the expression: (q :: a, p) In the expression: let (p :: a, q :: a) = x in (q :: a, p) • Relevant bindings include - p :: a (bound at tc141.hs:11:12) - q :: a (bound at tc141.hs:11:17) - x :: (a, a) (bound at tc141.hs:11:3) - f :: (a, a) -> (a1, a) (bound at tc141.hs:11:1) + p :: b (bound at tc141.hs:11:12) + q :: b (bound at tc141.hs:11:17) + x :: (b, b) (bound at tc141.hs:11:3) + f :: (b, b) -> (a, b) (bound at tc141.hs:11:1) tc141.hs:13:13: error: • You cannot bind scoped type variable ‘a’ diff --git a/testsuite/tests/typecheck/should_fail/T2688.stderr b/testsuite/tests/typecheck/should_fail/T2688.stderr index 63379a03b9..f7980d2734 100644 --- a/testsuite/tests/typecheck/should_fail/T2688.stderr +++ b/testsuite/tests/typecheck/should_fail/T2688.stderr @@ -3,10 +3,10 @@ T2688.hs:8:14: error: • Couldn't match expected type ‘v’ with actual type ‘s’ ‘s’ is a rigid type variable bound by the class declaration for ‘VectorSpace’ - at T2688.hs:(5,1)-(8,23) + at T2688.hs:5:21 ‘v’ is a rigid type variable bound by the class declaration for ‘VectorSpace’ - at T2688.hs:(5,1)-(8,23) + at T2688.hs:5:19 • In the expression: v *^ (1 / s) In an equation for ‘^/’: v ^/ s = v *^ (1 / s) • Relevant bindings include |