Skip to content

Commit 87c84a9

Browse files
committed
[astgen] Add test to prevent regressions.
1 parent f7909a8 commit 87c84a9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ extern "C" void parseTopLevelSwift(const char *buffer,
167167
void (*)(void *, void *));
168168

169169
static void appendToVector(void *declPtr, void *vecPtr) {
170-
auto vec = static_cast<SmallVectorImpl<Decl *> *>(vecPtr);
170+
auto vec = static_cast<SmallVectorImpl<ASTNode> *>(vecPtr);
171171
auto decl = static_cast<Decl *>(declPtr);
172172

173173
vec->push_back(decl);

test/ASTGen/verify-parse.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature SwiftParser -enable-experimental-feature ParserASTGen)
2+
3+
func test1(x: Int, fn: (Int) -> Int) -> Int {
4+
let xx = fn(42)
5+
return fn(x)
6+
}
7+
8+
func test2(b: Bool) {
9+
if b {
10+
print("TRUE")
11+
} else {
12+
print("FALSE")
13+
}
14+
15+
let x = true
16+
}
17+
18+
func test3(y: Int) -> Int {
19+
let x = y
20+
return x
21+
}

0 commit comments

Comments
 (0)