Skip to content

Commit 4ddd82f

Browse files
authored
Add regression test for fixed crasher (#20098)
In Swift 4.2, this example crashed. In Swift 5, it incorrectly diagnoses a type error. Eventually, it should actually succeed. For now, let's make sure we don't backslide to crashing.
1 parent 5018a4b commit 4ddd82f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// RUN: not %target-swift-frontend %s -emit-sil
9+
10+
// One day, if we're lucky, this test will start failing by emitting SIL
11+
// instead of diagnosing an error. If you are reading this comment because that
12+
// joyous day has finally arrived, please remove the "not" in the RUN line.
13+
// Until then, we will at least make sure we don't regress and start crashing
14+
// again.
15+
16+
func f() -> Int {
17+
return { a in
18+
{ [unowned a] b in
19+
a(b)
20+
}
21+
}(1)
22+
}

0 commit comments

Comments
 (0)