Commit 8246d4a5 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add test for GADTs and scoped type variables

parent 7d0200ab
...@@ -64,6 +64,8 @@ test('data2', normal, compile, ['']) ...@@ -64,6 +64,8 @@ test('data2', normal, compile, [''])
test('termination', normal, compile, ['']) test('termination', normal, compile, [''])
test('set', normal, compile, ['']) test('set', normal, compile, [''])
test('scoped', expect_broken(1823), compile, [''])
# New ones from Dimitrios # New ones from Dimitrios
......
{-# OPTIONS_GHC -XGADTs -XScopedTypeVariables -XPatternSignatures #-}
-- Tests for scoped type variables and GADTs
module GADT where
data C x y where
C :: a -> C a a
data D x y where
D :: C b c -> D a c
------- All these should be ok
-- Rejected!
g1 :: forall x y . C x y -> ()
-- C (..) :: C x y
-- Inside match on C, x=y
g1 (C (p :: y)) = ()
-- OK!
g2 :: forall x y . C x y -> ()
-- C (..) :: C x y
-- Inside match on C, x=y
g2 (C (p :: x)) = ()
-- Rejected!
g3 :: forall x y . D x y -> ()
-- D (..) :: D x y
-- C (..) :: C sk y
-- sk = y
-- p :: sk
g3 (D (C (p :: y))) = ()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment