diff options
author | Dr. Heinrich Hördegen <hoerdegen@energiefluss.info> | 2014-06-06 19:11:27 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-06-09 15:14:50 +0200 |
commit | 877a9577280f4b6aa6ef47f7a27d9b741b8234cf (patch) | |
tree | 70056c344df4a003b84074d33f7128322938bfca /testsuite/tests/warnings | |
parent | 4b4d81a6b97555a8dbeda2e6387ee151af962473 (diff) | |
download | haskell-877a9577280f4b6aa6ef47f7a27d9b741b8234cf.tar.gz |
Better warning message for orphan instances (Ticket #9178)
Including a test case.
Diffstat (limited to 'testsuite/tests/warnings')
5 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/warnings/should_compile/Makefile b/testsuite/tests/warnings/should_compile/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/warnings/should_compile/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/warnings/should_compile/T9178.hs b/testsuite/tests/warnings/should_compile/T9178.hs new file mode 100644 index 0000000000..9171381e35 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T9178.hs @@ -0,0 +1,9 @@ + + +module T9178 where + +import T9178DataType + + +instance Show T9178_Type where + show _ = undefined
\ No newline at end of file diff --git a/testsuite/tests/warnings/should_compile/T9178.stderr b/testsuite/tests/warnings/should_compile/T9178.stderr new file mode 100644 index 0000000000..6f4b6c0295 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T9178.stderr @@ -0,0 +1,8 @@ +[1 of 2] Compiling T9178DataType ( T9178DataType.hs, T9178DataType.o ) +[2 of 2] Compiling T9178 ( T9178.hs, T9178.o ) + +T9178.hs:8:10: Warning: + Orphan instance: instance Show T9178_Type + To avoid this + move the instance declaration to the module of the class or of the type, or + wrap the type with a newtype and declare the instance on the new type. diff --git a/testsuite/tests/warnings/should_compile/T9178DataType.hs b/testsuite/tests/warnings/should_compile/T9178DataType.hs new file mode 100644 index 0000000000..e274117fe3 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T9178DataType.hs @@ -0,0 +1,5 @@ + + +module T9178DataType where + +data T9178_Type diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T new file mode 100644 index 0000000000..f6747bf849 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/all.T @@ -0,0 +1,3 @@ +test('T9178', extra_clean(['T9178.o', 'T9178DataType.o', + 'T9178.hi', 'T9178DataType.hi']), + multimod_compile, ['T9178', '-Wall'])
\ No newline at end of file |