Skip to content

Commit 10d9545

Browse files
committed
Workaround for rdar://141977987
1 parent cd6c5cf commit 10d9545

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Sources/SwiftSyntax/Syntax.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ public struct Syntax: SyntaxProtocol, SyntaxHashable {
7070
}
7171

7272
public var id: SyntaxIdentifier {
73-
SyntaxIdentifier(
74-
rootId: UInt(rawID: arena.root.pointee.raw.id),
75-
indexInTree: SyntaxIdentifier.SyntaxIndexInTree(indexInTree: absoluteInfo.indexInTree)
76-
)
73+
withExtendedLifetime(self) { // 'withExtendedLifetime' for a potential compiler bug (rdar://141977987)
74+
SyntaxIdentifier(
75+
rootId: UInt(rawID: arena.root.pointee.raw.id),
76+
indexInTree: SyntaxIdentifier.SyntaxIndexInTree(indexInTree: absoluteInfo.indexInTree)
77+
)
78+
}
7779
}
7880

7981
/// The position of the start of this node's leading trivia

0 commit comments

Comments
 (0)