From c96a613c98d07fab4facc77bdd0701b7a17d332a Mon Sep 17 00:00:00 2001 From: David Terei Date: Mon, 4 Aug 2014 17:41:54 -0400 Subject: Add in Incoherent Instances test for Safe Haskell. --- testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs | 10 ++++++++++ testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr | 9 +++++++++ testsuite/tests/safeHaskell/safeInfered/all.T | 1 + 3 files changed, 20 insertions(+) create mode 100644 testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs create mode 100644 testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr (limited to 'testsuite/tests/safeHaskell/safeInfered') diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs new file mode 100644 index 0000000000..04591b5f77 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs @@ -0,0 +1,10 @@ +{-# OPTIONS_GHC -fwarn-unsafe -Werror #-} +{-# LANGUAGE FlexibleInstances #-} +module UnsafeInfered15 where + +class C a where + f :: a -> String + +instance {-# INCOHERENT #-} C a where + f _ = "a" + diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr new file mode 100644 index 0000000000..415e9a1f37 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr @@ -0,0 +1,9 @@ + +UnsafeInfered17.hs:1:16: Warning: + ‘UnsafeInfered15’ has been inferred as unsafe! + Reason: + UnsafeInfered17.hs:8:29: + [incoherent] overlap mode isn't allowed in Safe Haskell + +: +Failing due to -Werror. diff --git a/testsuite/tests/safeHaskell/safeInfered/all.T b/testsuite/tests/safeHaskell/safeInfered/all.T index a9600fa1c2..4fc9fcecb8 100644 --- a/testsuite/tests/safeHaskell/safeInfered/all.T +++ b/testsuite/tests/safeHaskell/safeInfered/all.T @@ -64,6 +64,7 @@ test('UnsafeInfered13', normal, compile_fail, ['']) test('UnsafeInfered14', normal, compile_fail, ['']) test('UnsafeInfered15', normal, compile_fail, ['']) test('UnsafeInfered16', normal, compile_fail, ['']) +test('UnsafeInfered17', normal, compile_fail, ['']) # Mixed tests test('Mixed01', normal, compile_fail, ['']) -- cgit v1.2.1