From 27d06f4e51660e11f4496d146441fd01071a9615 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Sun, 26 Sep 1999 16:05:35 +0000 Subject: [PATCH] [project @ 1999-09-26 16:05:34 by sof] Record construction tests --- ghc/tests/typecheck/should_fail/tcfail084.hs | 11 +++++++++++ ghc/tests/typecheck/should_fail/tcfail084.stderr | 7 +++++++ ghc/tests/typecheck/should_fail/tcfail085.hs | 10 ++++++++++ ghc/tests/typecheck/should_fail/tcfail085.stderr | 7 +++++++ 4 files changed, 35 insertions(+) create mode 100644 ghc/tests/typecheck/should_fail/tcfail084.hs create mode 100644 ghc/tests/typecheck/should_fail/tcfail084.stderr create mode 100644 ghc/tests/typecheck/should_fail/tcfail085.hs create mode 100644 ghc/tests/typecheck/should_fail/tcfail085.stderr diff --git a/ghc/tests/typecheck/should_fail/tcfail084.hs b/ghc/tests/typecheck/should_fail/tcfail084.hs new file mode 100644 index 000000000000..22b5456b1e3d --- /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 000000000000..5e54fb2b20f1 --- /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 000000000000..81036b9dfc39 --- /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 000000000000..2fc211da64aa --- /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 + -- GitLab