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(
550550/// a syntax tree.
551551fileprivate class RemoveUnsafeExprSyntaxRewriter : SyntaxRewriter {
552552 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)
554555 }
555556
556557 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 ) )
558560 }
559561}
560562
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ public struct SequenceWithUnsafeIterator: Sequence {
2323 // CHECK-NOT: unsafe
2424 print ( unsafe getIntUnsafely( ) )
2525
26- for unsafe _ in SequenceWithUnsafeIterator ( ) { }
26+ for unsafe _ in SequenceWithUnsafeIterator ( ) {
27+ _ = unsafe getIntUnsafely( )
28+ }
2729}
2830
2931// CHECK: public protocol P
You can’t perform that action at this time.
0 commit comments