diff options
author | Reid Barton <rwbarton@gmail.com> | 2017-03-02 16:29:55 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-02 19:58:01 -0500 |
commit | fce3d37c367346c67467ce3d56bc015fa9ed6062 (patch) | |
tree | b387645cf5ee628f67bfede42b6f77e432c667fa /testsuite/tests/patsyn | |
parent | 0b922909121f6a812d2861a29d0d0d3c7e2fcfce (diff) | |
download | haskell-fce3d37c367346c67467ce3d56bc015fa9ed6062.tar.gz |
Don't allow orphan COMPLETE pragmas (#13349)
We might support them properly in the future, but for now it's simpler
to disallow them.
Test Plan: validate
Reviewers: mpickering, austin, bgamari, simonpj
Reviewed By: mpickering, simonpj
Subscribers: simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D3243
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r-- | testsuite/tests/patsyn/should_compile/T13349b.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T13349.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T13349.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
5 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_compile/T13349b.hs b/testsuite/tests/patsyn/should_compile/T13349b.hs new file mode 100644 index 0000000000..9d77d5667f --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13349b.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PatternSynonyms #-} + +module T13349b where + +pattern Nada = Nothing + +-- Not orphan because it mentions the locally-defined Nada. +{-# COMPLETE Just, Nada #-} diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index a5066eaa09..87de2f00bb 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -63,3 +63,4 @@ test('T12615', normal, compile, ['']) test('T12698', normal, compile, ['']) test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) +test('T13349b', normal, compile, ['']) diff --git a/testsuite/tests/patsyn/should_fail/T13349.hs b/testsuite/tests/patsyn/should_fail/T13349.hs new file mode 100644 index 0000000000..45bdc23ace --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T13349.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PatternSynonyms #-} + +module T13349 where + +{-# COMPLETE False #-} diff --git a/testsuite/tests/patsyn/should_fail/T13349.stderr b/testsuite/tests/patsyn/should_fail/T13349.stderr new file mode 100644 index 0000000000..5bf91cbaa4 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T13349.stderr @@ -0,0 +1,6 @@ + +T13349.hs:5:1: error: + • Orphan COMPLETE pragmas not supported + A COMPLETE pragma must mention at least one data constructor + or pattern synonym defined in the same module. + • In {-# COMPLETE False #-} diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 50a3eea6c1..f674a8b258 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -34,3 +34,4 @@ test('T11667', normal, compile_fail, ['']) test('T12165', normal, compile_fail, ['']) test('T12819', normal, compile_fail, ['']) test('UnliftedPSBind', normal, compile_fail, ['']) +test('T13349', normal, compile_fail, ['']) |