File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
lib/ASTGen/Sources/ASTGen Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -550,11 +550,13 @@ public func extractInlinableText(
550
550
/// a syntax tree.
551
551
fileprivate class RemoveUnsafeExprSyntaxRewriter : SyntaxRewriter {
552
552
override func visit( _ node: UnsafeExprSyntax ) -> ExprSyntax {
553
- return node. expression. with ( \. leadingTrivia, node. leadingTrivia)
553
+ let rewritten = super. visit ( node) . cast ( UnsafeExprSyntax . self)
554
+ return rewritten. expression. with ( \. leadingTrivia, node. leadingTrivia)
554
555
}
555
556
556
557
override func visit( _ node: ForStmtSyntax ) -> StmtSyntax {
557
- return StmtSyntax ( node. with ( \. unsafeKeyword, nil ) )
558
+ let rewritten = super. visit ( node) . cast ( ForStmtSyntax . self)
559
+ return StmtSyntax ( rewritten. with ( \. unsafeKeyword, nil ) )
558
560
}
559
561
}
560
562
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ public struct SequenceWithUnsafeIterator: Sequence {
23
23
// CHECK-NOT: unsafe
24
24
print ( unsafe getIntUnsafely( ) )
25
25
26
- for unsafe _ in SequenceWithUnsafeIterator ( ) { }
26
+ for unsafe _ in SequenceWithUnsafeIterator ( ) {
27
+ _ = unsafe getIntUnsafely( )
28
+ }
27
29
}
28
30
29
31
// CHECK: public protocol P
You can’t perform that action at this time.
0 commit comments