diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-07-09 17:20:06 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-07-10 09:28:43 +0100 |
commit | aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8 (patch) | |
tree | 0e782ee467b45f4914215863a38833849a2b26d8 /testsuite | |
parent | fd0f0334189c0c5c9b186bd1b009f706d3d86086 (diff) | |
download | haskell-aedbf7f1c402ecbcb5ff192d5fb4dd6dd4771bf8.tar.gz |
Fix decompsePiCos and visible type application
Trac #15343 was caused by two things
First, in TcHsType.tcHsTypeApp, which deals with the type argment
in visible type application, we were failing to call
solveLocalEqualities. But the type argument is like a user type
signature so it's at least inconsitent not to do so.
I thought that would nail it. But it didn't. It turned out that we
were ended up calling decomposePiCos on a type looking like this
(f |> co) Int
where co :: (forall a. ty) ~ (t1 -> t2)
Now, 'co' is insoluble, and we'll report that later. But meanwhile
we don't want to crash in decomposePiCos.
My fix involves keeping track of the type on both sides of the
coercion, and ensuring that the outer shape matches before
decomposing. I wish there was a simpler way to do this. But
I think this one is at least robust.
I suppose it is possible that the decomposePiCos fix would
have cured the original report, but I'm leaving the one-line
tcHsTypeApp fix in too because it just seems more consistent.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/dependent/should_fail/T15343.hs | 14 | ||||
-rw-r--r-- | testsuite/tests/dependent/should_fail/T15343.stderr | 7 | ||||
-rw-r--r-- | testsuite/tests/dependent/should_fail/all.T | 2 |
3 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/dependent/should_fail/T15343.hs b/testsuite/tests/dependent/should_fail/T15343.hs new file mode 100644 index 0000000000..9bb59c807a --- /dev/null +++ b/testsuite/tests/dependent/should_fail/T15343.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeInType #-} +module T15343 where + +import Data.Kind + +elimSing :: forall (p :: forall z. z). p +elimSing = undefined + +data WhySym :: Type -> Type + +hsym = elimSing @WhySym diff --git a/testsuite/tests/dependent/should_fail/T15343.stderr b/testsuite/tests/dependent/should_fail/T15343.stderr new file mode 100644 index 0000000000..79d81e5772 --- /dev/null +++ b/testsuite/tests/dependent/should_fail/T15343.stderr @@ -0,0 +1,7 @@ + +T15343.hs:14:18: error: + • Expecting one more argument to ‘WhySym’ + Expected kind ‘forall z. z’, but ‘WhySym’ has kind ‘* -> *’ + • In the type ‘WhySym’ + In the expression: elimSing @WhySym + In an equation for ‘hsym’: hsym = elimSing @WhySym diff --git a/testsuite/tests/dependent/should_fail/all.T b/testsuite/tests/dependent/should_fail/all.T index 1bc3f42a92..59d80375ff 100644 --- a/testsuite/tests/dependent/should_fail/all.T +++ b/testsuite/tests/dependent/should_fail/all.T @@ -33,3 +33,5 @@ test('InferDependency', normal, compile_fail, ['']) test('T15245', normal, compile_fail, ['']) test('T15215', normal, compile_fail, ['']) test('T15308', normal, compile_fail, ['-fno-print-explicit-kinds']) +test('T15343', normal, compile_fail, ['']) + |