Skip to content

Commit 8559d3c

Browse files
committed
fix issue printing the forget statement in the AST
`kw_forget` isn't covered by `operator<<` since it's not a normal keyword.
1 parent 404267d commit 8559d3c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5177,7 +5177,7 @@ void PrintAST::visitThrowStmt(ThrowStmt *stmt) {
51775177
}
51785178

51795179
void PrintAST::visitForgetStmt(ForgetStmt *stmt) {
5180-
Printer << tok::kw_forget << " ";
5180+
Printer << "_forget" << " ";
51815181
visit(stmt->getSubExpr());
51825182
}
51835183

test/expr/print/forget.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -enable-experimental-move-only -print-ast %s 2>&1 | %FileCheck %s
2+
3+
@_moveOnly
4+
struct S {
5+
__consuming func c() {
6+
_forget self
7+
}
8+
}
9+
10+
// CHECK: @_moveOnly internal struct S {
11+
// CHECK: internal __consuming func c() {
12+
// CHECK: _forget self
13+
// CHECK: }

0 commit comments

Comments
 (0)