swiftlang/swift-syntax

`DiagnosticsFormatter` crashes when source code contains an emoji

Matejkob opened this issue · 1 comments

Description

DiagnosticsFormatter crashes with a Fatal error: Range requires lowerBound <= upperBound message when the source code contains an emoji.

Screenshot 2024-02-21 at 10 51 44 PM

Steps to Reproduce

Run:

swift run swift-parser-cli print-diags -s 'func o() {
  _ = {
    0
    /x}}1️⃣} /
    2
  }
}'

This version:

swift run swift-parser-cli print-diags -s 'func o() {
  _ = {
    0
    /x}}$} /
    2
  }
}'

works.

Tested on main.

Tracked in Apple’s issue tracker as rdar://123409748