diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-07-03 22:37:18 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-07-03 22:44:50 +0200 |
commit | 6b01d3ce6c681428e7a9865af85685c2a76ba657 (patch) | |
tree | 1c3a846b5bfb22e45077235e14ee807d643ce59a /testsuite/tests | |
parent | 39d83f239d33b1d214bdb7f7b3ce94d76d3e1467 (diff) | |
download | haskell-6b01d3ce6c681428e7a9865af85685c2a76ba657.tar.gz |
parser: Allow Lm (MODIFIER LETTER) category in identifiers
Easy fix in the parser to stop regressions, due to Unicode 7.0 changing
the classification of some prior code points.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Test Plan: `tests/parser/should_compile/T10196.hs`
Reviewers: hvr, austin, bgamari
Reviewed By: austin, bgamari
Subscribers: thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D969
GHC Trac Issues: #10196
Diffstat (limited to 'testsuite/tests')
9 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_compile/T10196.hs b/testsuite/tests/parser/should_compile/T10196.hs new file mode 100644 index 0000000000..f80911829b --- /dev/null +++ b/testsuite/tests/parser/should_compile/T10196.hs @@ -0,0 +1,13 @@ +module T10196 where + +data X = Xᵦ | Xᵤ | Xᵩ | Xᵢ | Xᵪ | Xᵣ + +f :: Int +f = + let xᵦ = 1 + xᵤ = xᵦ + xᵩ = xᵤ + xᵢ = xᵩ + xᵪ = xᵢ + xᵣ = xᵪ + in xᵣ diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 68845c1cc6..521b5a42a0 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -101,4 +101,5 @@ test('T5682', normal, compile, ['']) test('T9723a', normal, compile, ['']) test('T9723b', normal, compile, ['']) test('T10188', normal, compile, ['']) +test('T10196', normal, compile, ['']) test('T10582', expect_broken(10582), compile, ['']) diff --git a/testsuite/tests/parser/should_fail/T10196Fail1.hs b/testsuite/tests/parser/should_fail/T10196Fail1.hs new file mode 100644 index 0000000000..2f1c8f39ea --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail1.hs @@ -0,0 +1,4 @@ +module T10196Fail1 where + +-- Constructors are not allowed to start with a modifier letter. +data Foo = ᵦfoo diff --git a/testsuite/tests/parser/should_fail/T10196Fail1.stderr b/testsuite/tests/parser/should_fail/T10196Fail1.stderr new file mode 100644 index 0000000000..3c4a173eef --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail1.stderr @@ -0,0 +1,2 @@ + +T10196Fail1.hs:4:12: error: lexical error at character '\7526' diff --git a/testsuite/tests/parser/should_fail/T10196Fail2.hs b/testsuite/tests/parser/should_fail/T10196Fail2.hs new file mode 100644 index 0000000000..64b3cacd62 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail2.hs @@ -0,0 +1,4 @@ +module T10196Fail2 where + +-- Variables are not allowed to start with a modifier letter. +ᵦ = 1 diff --git a/testsuite/tests/parser/should_fail/T10196Fail2.stderr b/testsuite/tests/parser/should_fail/T10196Fail2.stderr new file mode 100644 index 0000000000..abba8aa04c --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail2.stderr @@ -0,0 +1,2 @@ + +T10196Fail2.hs:4:1: error: lexical error at character '\7526' diff --git a/testsuite/tests/parser/should_fail/T10196Fail3.hs b/testsuite/tests/parser/should_fail/T10196Fail3.hs new file mode 100644 index 0000000000..09b80ddeff --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail3.hs @@ -0,0 +1,6 @@ +module T10196Fail3 where + +-- Modifier letters are not allowed in the middle of an identifier. +-- And this should not be lexed as 2 separate identifiers either. +xᵦx :: Int +xᵦx = 1 diff --git a/testsuite/tests/parser/should_fail/T10196Fail3.stderr b/testsuite/tests/parser/should_fail/T10196Fail3.stderr new file mode 100644 index 0000000000..64037440e2 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T10196Fail3.stderr @@ -0,0 +1,2 @@ + +T10196Fail3.hs:5:2: error: lexical error at character '/7526' diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index affea929d3..33da7217a7 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -88,3 +88,6 @@ test('T8431', compile_timeout_multiplier(0.05), compile_fail, ['-XAlternativeLayoutRule']) test('T8506', normal, compile_fail, ['']) test('T9225', normal, compile_fail, ['']) +test('T10196Fail1', normal, compile_fail, ['']) +test('T10196Fail2', normal, compile_fail, ['']) +test('T10196Fail3', expect_broken(10196), compile_fail, ['']) |