diff options
author | HE, Tao <sighingnow@gmail.com> | 2018-02-18 11:10:37 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-02-18 11:57:46 -0500 |
commit | fc33f8b31b9c23cc12f02a028bbaeab06ba8fe96 (patch) | |
tree | fb6def5fbe3eba0a02b59cfee383b2927f4c245f /testsuite/tests | |
parent | d924c17dfc8d277a7460fa57217a9ab82f78ee4e (diff) | |
download | haskell-fc33f8b31b9c23cc12f02a028bbaeab06ba8fe96.tar.gz |
Improve error message for UNPACK/strictness annotations.
Print different error message for improper UNPACK and strictness
annotations. Fix Trac #14761.
Signed-off-by: HE, Tao <sighingnow@gmail.com>
Test Plan: make test TEST="T7210 T14761a T14761b"
Reviewers: goldfire, bgamari, RyanGlScott, simonpj
Reviewed By: RyanGlScott, simonpj
Subscribers: simonpj, goldfire, rwbarton, thomie, carter
GHC Trac Issues: #14761
Differential Revision: https://phabricator.haskell.org/D4397
Diffstat (limited to 'testsuite/tests')
6 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T14761a.hs b/testsuite/tests/typecheck/should_fail/T14761a.hs new file mode 100644 index 0000000000..f195320186 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14761a.hs @@ -0,0 +1,3 @@ +module T14761a where + +data A = A { a :: {-# UNPACK #-} Maybe Int} diff --git a/testsuite/tests/typecheck/should_fail/T14761a.stderr b/testsuite/tests/typecheck/should_fail/T14761a.stderr new file mode 100644 index 0000000000..8eb4580db4 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14761a.stderr @@ -0,0 +1,7 @@ + +T14761a.hs:3:19: + Unexpected UNPACK annotation: {-# UNPACK #-}Maybe + UNPACK annotation cannot appear nested inside a type + In the type ‘{-# UNPACK #-}Maybe Int’ + In the definition of data constructor ‘A’ + In the data declaration for ‘A’ diff --git a/testsuite/tests/typecheck/should_fail/T14761b.hs b/testsuite/tests/typecheck/should_fail/T14761b.hs new file mode 100644 index 0000000000..cd5196259f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14761b.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE BangPatterns #-} + +module T14761b where + +data A = A { a :: ! Maybe Int} diff --git a/testsuite/tests/typecheck/should_fail/T14761b.stderr b/testsuite/tests/typecheck/should_fail/T14761b.stderr new file mode 100644 index 0000000000..8357187928 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T14761b.stderr @@ -0,0 +1,7 @@ + +T14761b.hs:5:19: + Unexpected strictness annotation: !Maybe + strictness annotation cannot appear nested inside a type + In the type ‘!Maybe Int’ + In the definition of data constructor ‘A’ + In the data declaration for ‘A’ diff --git a/testsuite/tests/typecheck/should_fail/T7210.stderr b/testsuite/tests/typecheck/should_fail/T7210.stderr index a7ee2afc85..314ffa70e7 100644 --- a/testsuite/tests/typecheck/should_fail/T7210.stderr +++ b/testsuite/tests/typecheck/should_fail/T7210.stderr @@ -1,6 +1,7 @@ T7210.hs:5:19: Unexpected strictness annotation: !IntMap + strictness annotation cannot appear nested inside a type In the type ‘!IntMap Int’ In the definition of data constructor ‘C’ In the data declaration for ‘T’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index b8c3c4c1eb..20ed5a4ade 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -465,3 +465,5 @@ test('MissingExportList03', normal, compile_fail, ['']) test('T14618', normal, compile_fail, ['']) test('T14607', normal, compile, ['']) test('T14605', normal, compile_fail, ['']) +test('T14761a', normal, compile_fail, ['']) +test('T14761b', normal, compile_fail, ['']) |