Skip to content

Commit 2ea5486

Browse files
committed
Add known type checker crashers.
Add minimized tests for: rdar://problem/27464577 rdar://problem/27575060 rdar://problem/27680407 rdar://problem/27787341 rdar://problem/27815848 As these (and other tests added here) are fixed, we can move them into a new type_checker_crashers_fixed directory.
1 parent c8fbfb7 commit 2ea5486

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)