Skip to content

Commit

Permalink
loosen unicode directional character check
Browse files Browse the repository at this point in the history
as per discussion on scala#10017, we were flagging too many characters.
a false positive came up in the community build; I modified
the test case to include it.
  • Loading branch information
SethTisue committed May 9, 2022
1 parent 29e696f commit e5883ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/reflect/scala/reflect/internal/Chars.scala
Expand Up @@ -105,9 +105,7 @@ trait Chars {
}

def isBiDiCharacter(c: Char): Boolean = (c: @switch) match {
case '\u061c' |
'\u200e' | '\u200f' |
'\u202a' | '\u202b' | '\u202c' | '\u202d' | '\u202e' |
case '\u202a' | '\u202b' | '\u202c' | '\u202d' | '\u202e' |
'\u2066' | '\u2067' | '\u2068' | '\u2069' => true
case _ => false
}
Expand Down
6 changes: 3 additions & 3 deletions test/files/neg/t12478.check
Expand Up @@ -19,13 +19,13 @@ t12478.scala:9: error: found unicode bidirectional character '\u202e'; use a uni
t12478.scala:11: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
// comm‮tne
^
t12478.scala:13: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
t12478.scala:16: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
"""te‮tx"""
^
t12478.scala:14: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
t12478.scala:17: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
raw"""te‮tx"""
^
t12478.scala:16: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
t12478.scala:19: error: found unicode bidirectional character '\u202e'; use a unicode escape instead
val u202e = '‮'
^
10 errors found
3 changes: 3 additions & 0 deletions test/files/neg/t12478.scala
Expand Up @@ -10,6 +10,9 @@ object Test {

// comm‮tne

// comment with direction indicator that isn't a threat:
// - From the Latin "coævus": com- ‎("equal") in combination with aevum ‎(aevum, "age").

"""te‮tx"""
raw"""te‮tx"""

Expand Down

0 comments on commit e5883ad

Please sign in to comment.