-
Notifications
You must be signed in to change notification settings - Fork 447
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
using the trimmed
family of SyntaxProtocol
methods corrupts the ByteSourceRange
s when obtaining syntax classifications.
i was able to reproduce this on 510.0.2
, and on 600.0.0-prerelease-2024-06-12
.
Steps to Reproduce
import SwiftIDEUtils
import SwiftParser
import SwiftSyntax
let text:String = """
@_documentation(metadata: blah)
public mutating
func f() {}
"""
let utf8:[UInt8] = .init(text.utf8)
var parser:Parser = utf8.withUnsafeBufferPointer { .init($0) }
let decl:DeclSyntax = .parse(from: &parser)
let function:FunctionDeclSyntax = decl.as(FunctionDeclSyntax.self)!
for span:SyntaxClassifiedRange in function.modifiers.trimmed.classifications
{
let range:Range<Int> = span.range.offset ..< span.range.offset + span.range.length
print(String.init(decoding: utf8[range], as: Unicode.UTF8.self))
}
publi
c
mutatin
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working