diff options
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r-- | testsuite/tests/patsyn/should_compile/T9793.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T9793-fail.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T9793-fail.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/as-pattern.stderr | 4 |
6 files changed, 19 insertions, 2 deletions
diff --git a/testsuite/tests/patsyn/should_compile/T9793.hs b/testsuite/tests/patsyn/should_compile/T9793.hs new file mode 100644 index 0000000000..230c8618a4 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T9793.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PatternSynonyms #-} +module T9793 where + +pattern P :: [a] -> [a] +pattern P x <- x@(_:_) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 7ab5ac7e7c..3793c0d322 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -44,3 +44,4 @@ test('export-record-selector', normal, compile, ['']) test('T10897', expect_broken(10897), multi_compile, ['T10897', [ ('T10897a.hs','-c') ,('T10897b.hs', '-c')], '']) +test('T9793', normal, compile, ['']) diff --git a/testsuite/tests/patsyn/should_fail/T9793-fail.hs b/testsuite/tests/patsyn/should_fail/T9793-fail.hs new file mode 100644 index 0000000000..2787a8d6ca --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T9793-fail.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} + +module Foo where + +pattern P :: [a] -> [a] +pattern P x <- x@(y:_) diff --git a/testsuite/tests/patsyn/should_fail/T9793-fail.stderr b/testsuite/tests/patsyn/should_fail/T9793-fail.stderr new file mode 100644 index 0000000000..62713dcd4c --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T9793-fail.stderr @@ -0,0 +1,4 @@ + +T9793-fail.hs:6:16: error: + Pattern synonym definition cannot contain as-patterns (@) which contain free variables: + x@(y : _) diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 6ef64ae5ed..6163da1aab 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -27,3 +27,4 @@ test('export-type-synonym', normal, compile_fail, ['']) test('export-ps-rec-sel', normal, compile_fail, ['']) test('T11053', normal, compile, ['-fwarn-missing-pat-syn-sigs']) test('T10426', normal, compile_fail, ['']) +test('T9793-fail', normal, compile_fail, ['']) diff --git a/testsuite/tests/patsyn/should_fail/as-pattern.stderr b/testsuite/tests/patsyn/should_fail/as-pattern.stderr index 62db28f023..caabd47090 100644 --- a/testsuite/tests/patsyn/should_fail/as-pattern.stderr +++ b/testsuite/tests/patsyn/should_fail/as-pattern.stderr @@ -1,4 +1,4 @@ -as-pattern.hs:4:18: - Pattern synonym definition cannot contain as-patterns (@): +as-pattern.hs:4:18: error: + Pattern synonym definition cannot contain as-patterns (@) which contain free variables: x@(Just y) |