Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error on source files with unicode directional formatting characters
Don't allow characters with unicode property `Bidi_Class` in source files.
- Loading branch information
Showing
7 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
t12478.scala:3: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
accessLevel != "user // Check if admin " | ||
^ | ||
t12478.scala:3: error: found unicode bidirectional character '\u2066'; in a string or character literal, use a unicode escape instead | ||
accessLevel != "user // Check if admin " | ||
^ | ||
t12478.scala:3: error: found unicode bidirectional character '\u2069'; in a string or character literal, use a unicode escape instead | ||
accessLevel != "user // Check if admin " | ||
^ | ||
t12478.scala:3: error: found unicode bidirectional character '\u2066'; in a string or character literal, use a unicode escape instead | ||
accessLevel != "user // Check if admin " | ||
^ | ||
t12478.scala:7: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
class C | ||
^ | ||
t12478.scala:9: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
def acb | ||
^ | ||
t12478.scala:11: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
// commtne | ||
^ | ||
t12478.scala:13: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
"""tetx""" | ||
^ | ||
t12478.scala:14: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
raw"""tetx""" | ||
^ | ||
t12478.scala:16: error: found unicode bidirectional character '\u202e'; in a string or character literal, use a unicode escape instead | ||
val u202e = '' | ||
^ | ||
10 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
object Test { | ||
def isAdmin(accessLevel: String): Boolean = | ||
accessLevel != "user // Check if admin " | ||
|
||
def שרה = 0 // no bidi override char, these characters are rtl | ||
|
||
class C | ||
|
||
def acb | ||
|
||
// commtne | ||
|
||
"""tetx""" | ||
raw"""tetx""" | ||
|
||
val u202e = '' | ||
|
||
def main(args: Array[String]): Unit = { | ||
println(isAdmin("user")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
abdc | ||
abdc | ||
Sarah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
object Test { | ||
val oks = "ab\u202edc\u202c" | ||
val okc = '\u202e' | ||
|
||
def שרה = "Sarah" | ||
|
||
def main(args: Array[String]): Unit = { | ||
println(oks) | ||
println(s"ab${okc}dc\u202c") | ||
println(שרה) | ||
} | ||
} |