From: sof Date: Sun, 26 Sep 1999 16:05:35 +0000 (+0000) Subject: [project @ 1999-09-26 16:05:34 by sof] X-Git-Tag: Approximately_9120_patches~5746 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=27d06f4e51660e11f4496d146441fd01071a9615;p=ghc-hetmet.git [project @ 1999-09-26 16:05:34 by sof] Record construction tests --- diff --git a/ghc/tests/typecheck/should_fail/tcfail084.hs b/ghc/tests/typecheck/should_fail/tcfail084.hs new file mode 100644 index 0000000..22b5456 --- /dev/null +++ b/ghc/tests/typecheck/should_fail/tcfail084.hs @@ -0,0 +1,11 @@ +-- !!! Check that using a label belonging to another constructor +-- !!! is flagged as being incorrect. +module ShouldFail where + +data F + = F { x :: Int } + | G { y :: Int } + +z :: F +z = F { y = 2 } + diff --git a/ghc/tests/typecheck/should_fail/tcfail084.stderr b/ghc/tests/typecheck/should_fail/tcfail084.stderr new file mode 100644 index 0000000..5e54fb2 --- /dev/null +++ b/ghc/tests/typecheck/should_fail/tcfail084.stderr @@ -0,0 +1,7 @@ + +tcfail084.hs:10: + Constructor `F' does not have field `y' + In the right-hand side of a pattern binding: F {y = 2} + +Compilation had errors + diff --git a/ghc/tests/typecheck/should_fail/tcfail085.hs b/ghc/tests/typecheck/should_fail/tcfail085.hs new file mode 100644 index 0000000..81036b9 --- /dev/null +++ b/ghc/tests/typecheck/should_fail/tcfail085.hs @@ -0,0 +1,10 @@ +-- !!! Check that not supplying bindings for strict fields +-- !!! is flagged as being incorrect. +module ShouldFail where + +data F + = F { x :: Int, y :: !Int } + +z :: F +z = F { x = 2 } + diff --git a/ghc/tests/typecheck/should_fail/tcfail085.stderr b/ghc/tests/typecheck/should_fail/tcfail085.stderr new file mode 100644 index 0000000..2fc211d --- /dev/null +++ b/ghc/tests/typecheck/should_fail/tcfail085.stderr @@ -0,0 +1,7 @@ + +tcfail085.hs:9: + Constructor `F' does not have the required strict field `y' + In the right-hand side of a pattern binding: F {x = 2} + +Compilation had errors +