Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
a2ce2609
Commit
a2ce2609
authored
Apr 10, 2008
by
simonpj
Browse files
Test for GADT escape (I forget which Trac bug this is for, if any)
parent
f038d224
Changes
3
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/gadt/all.T
View file @
a2ce2609
...
...
@@ -67,6 +67,7 @@ test('set', normal, compile, [''])
test
('
scoped
',
expect_broken
(
1823
),
compile
,
[''])
test
('
gadt-escape1
',
normal
,
compile_fail
,
[''])
# New ones from Dimitrios
...
...
testsuite/tests/ghc-regress/gadt/gadt-escape1.hs
0 → 100644
View file @
a2ce2609
{-# OPTIONS -XGADTs -XExistentialQuantification #-}
module
Escape
where
data
ExpGADT
t
where
ExpInt
::
Int
->
ExpGADT
Int
data
Hidden
=
forall
t
.
Hidden
(
ExpGADT
t
)
(
ExpGADT
t
)
hval
=
Hidden
(
ExpInt
0
)
(
ExpInt
1
)
-- With the type sig this is ok, but without it should
-- be rejected becuase the result type is wobbly
-- weird1 :: ExpGADT Int
weird1
=
case
(
hval
::
Hidden
)
of
Hidden
(
ExpInt
_
)
a
->
a
weird2
::
ExpGADT
Int
weird2
=
case
(
hval
::
Hidden
)
of
Hidden
(
ExpInt
_
)
a
->
a
testsuite/tests/ghc-regress/gadt/gadt-escape1.stderr
0 → 100644
View file @
a2ce2609
gadt-escape1.hs:16:52:
GADT pattern match with non-rigid result type `t'
Solution: add a type signature
In a case alternative: Hidden (ExpInt _) a -> a
In the expression:
case (hval :: Hidden) of Hidden (ExpInt _) a -> a
In the definition of `weird1':
weird1 = case (hval :: Hidden) of Hidden (ExpInt _) a -> a
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment