[project @ 2000-08-30 07:36:47 by simonpj]
authorsimonpj <unknown>
Wed, 30 Aug 2000 07:36:47 +0000 (07:36 +0000)
committersimonpj <unknown>
Wed, 30 Aug 2000 07:36:47 +0000 (07:36 +0000)
Add test for selectors in data/newtype with contexts

ghc/tests/typecheck/should_run/tcrun006.hs [new file with mode: 0644]
ghc/tests/typecheck/should_run/tcrun006.stdout [new file with mode: 0644]

diff --git a/ghc/tests/typecheck/should_run/tcrun006.hs b/ghc/tests/typecheck/should_run/tcrun006.hs
new file mode 100644 (file)
index 0000000..c55ef88
--- /dev/null
@@ -0,0 +1,15 @@
+-- !!! Selectors for data and newtypes with contexts
+
+-- This program, reported in Aug'00 by Jose Emilio Labra Gayo
+-- gave rise to a Lint error because the selector 'newout' below
+-- was given the type
+--     Eq f => NewT f -> f
+-- but lacked a dictionary argument in its body.
+
+module Main where
+
+newtype (Eq f) => NewT  f = NewIn  { newout  :: f } 
+data    (Eq f) => DataT f = DataIn { dataout :: f } 
+
+main = print (newout (NewIn "ok new") ++ dataout (DataIn " ok data"))
+
diff --git a/ghc/tests/typecheck/should_run/tcrun006.stdout b/ghc/tests/typecheck/should_run/tcrun006.stdout
new file mode 100644 (file)
index 0000000..e96d077
--- /dev/null
@@ -0,0 +1 @@
+"ok new ok data"