diff --git a/ghc/tests/typecheck/should_fail/tcfail084.hs b/ghc/tests/typecheck/should_fail/tcfail084.hs new file mode 100644 index 0000000000000000000000000000000000000000..22b5456b1e3d404cec078be37a9a62584c61bc56 --- /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 0000000000000000000000000000000000000000..5e54fb2b20f1fd3c37e6f693c1545efcf40b750a --- /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 0000000000000000000000000000000000000000..81036b9dfc39ec590d59cd62dc4d7e0b4093bb0d --- /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 0000000000000000000000000000000000000000..2fc211da64aa2025323565637112ae1c15c4414a --- /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 +