Skip to content

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

Closed
@hamishknight

Description

@hamishknight

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions