apple / swift-experimental-string-processing

An early experimental general-purpose pattern matching engine for Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeScalar as a RegexComponent uses scalar semantics even under grapheme semantic mode

hamishknight opened this issue · comments

The following produces a match:

let r = Regex {
  "a" as UnicodeScalar
}

print(try! r1.firstMatch(in: "a\u{301}"))

however under grapheme semantic mode, it shouldn't. This also affects the CharacterClass.anyOf API, e.g:

let r = Regex {
  CharacterClass.anyOf(["a" as UnicodeScalar, "👍"])
}
print(try! r.firstMatch(in: "a\u{301}"))

also incorrectly produces a match (the use of "👍" is to defeat an optimization that would otherwise have the correct semantics).

rdar://96662651