Skip to content

can't use string interpolator with unicode characters from categories Ll, Lu, Lt, Nl #12486

Closed
scala/scala
#9805
@unkarjedy

Description

@unkarjedy

Scala 2.13.7

From https://www.scala-lang.org/files/archive/spec/2.13/13-syntax-summary.html:

interpolatedString ::=  alphaid ...
alphaid          ::=  upper idrest
                   |  varid // lower idrest
upper            ::=  ... any character in Unicode categories Lu, Lt or Nl,
                      and any character in Unicode categories Lo and Lm that don't have
                      contributory property Other_Lowercase
lower            ::=  ‘a’ | … | ‘z’ | ‘_’ and any character in Unicode category Ll,
                      and any character in Unicode categories Lo or Lm that has contributory
                      property Other_Lowercase
object O2 {
  //OK
  a"${1}"

  // false compiler error: ';' expected but string literal found
  𝓅"${1}"
  𐐀"${1}"
  Dž"${1}""${1}"

  implicit class MyInterpolators(sc: StringContext) {
    def a(subs: Any*): String = ???
    def 𝓅(subs: Any*): String = ??? // category: Ll
    def 𐐀(subs: Any*): String = ??? // category: Lu
    def Dž(subs: Any*): String = ??? // category: Lt
    def (subs: Any*): String = ??? // category: Nl
  }
}

JFR All identifiers are accepted by the Java compiler

class MyJava {
    public void 𝓅() {}
    public void 𐐀() {}
    public void Dž() {}
    public void () {}
}

relates to:
#1406
scala/scala#9687

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions