Skip to content

Commit 0443844

Browse files
authored
Merge pull request #4290 from rudkx/type_checker_crashers
Add known type checker crashers.
2 parents ccc2ff9 + 2ea5486 commit 0443844

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
3+
_ = [1].map { v -> T in return v as? Int }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
// REQUIRES: asserts
3+
4+
func f(_ x: Any...) {}
5+
6+
var a = 1
7+
f((a, 2))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
3+
struct rdar27680407 : ExpressibleByStringLiteral {
4+
let value: String
5+
6+
// Stack overflow while validating rdar27680407.StringLiteralType.
7+
init(stringLiteral value: rdar27680407.StringLiteralType) {
8+
self.value = value
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
3+
_ = [1].reduce([:]) { $0[$1] }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
3+
class C {}
4+
class D : C {}
5+
6+
@_silgen_name("consume")
7+
func consume(_: [C]) // note, returns ()
8+
9+
// Assert/crash while emitting diagnostic for coercion from () to Bool
10+
// in the context of a collection cast.
11+
func test(x: [D]) -> Bool {
12+
return consume(x) // no way to coerce from () to Bool
13+
}

0 commit comments

Comments
 (0)