Skip to content

Commit aec4465

Browse files
committed
[test] Add some more known type-checker crashers
1 parent 17cbe28 commit aec4465

24 files changed

+186
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::constraints::ConstraintGraph::removeConstraint(swift::TypeVariableType*, swift::constraints::Constraint*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
[{
4+
a
5+
b
6+
}
7+
c.d<b>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"std::__1::__function::__func<deriveBodyDecodable_enum_init(swift::AbstractFunctionDecl*, void*)::$_0, std::__1::allocator<deriveBodyDecodable_enum_init(swift::AbstractFunctionDecl*, void*)::$_0>, std::__1::tuple<swift::EnumElementDecl*, swift::BraceStmt*> (swift::EnumElementDecl*, swift::EnumElementDecl*, llvm::ArrayRef<swift::VarDecl*>)>::operator()(swift::EnumElementDecl*&&, swift::EnumElementDecl*&&, llvm::ArrayRef<swift::VarDecl*>&&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
enum a : Codable { case x( x : Int b : Double enum XCodingKeys : CodingKey{
4+
x case x case b let c = a
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// {"signature":"swift::NamingPatternRequest::evaluate(swift::Evaluator&, swift::VarDecl*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
let a = $0.c ;
5+
switch a {
6+
case let \ (b) where b:
7+
}
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// {"signature":"swift::ASTPrinter::printName(swift::Identifier, swift::PrintNameContext, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a: Collection where Element == b.Element! {
4+
associatedtype b: Collection
5+
}
6+
protocol c {
7+
associatedtype d: a where d.b: a, d.Element == Self
8+
}
9+
func e () {
10+
func f<e : c>() {
11+
e.g
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::TypeTransform<(anonymous namespace)::TypeSubstituter>::doIt(swift::Type, swift::TypePosition)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a: Collection where Iterator == Self
4+
struct b<c: a>: IteratorProtocol {next -> c.Element? struct c: a {
5+
struct Element
6+
subscript(Int) Element
7+
func makeIterator -> b<Self>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::getTypeOfReference(swift::ValueDecl*, swift::FunctionRefInfo, swift::constraints::ConstraintLocatorBuilder, swift::DeclContext*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<b>((__shared b) -> Void)
4+
func c(UnsafeMutablePointer<UInt8>) a {
5+
c(&$0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// {"signature":"(anonymous namespace)::Traversal::doIt(swift::Expr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
for b 0 ..< 10 {
5+
let a = Array(0 ..< b)
6+
for c d a{
7+
for e d c... {
8+
Array(a[c ..< e].reversed())
9+
f
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::TypeChecker::typeCheckCheckedCast(swift::Type, swift::Type, swift::CheckedCastContextKind, swift::DeclContext*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
init(a : () -> ()) {
4+
[.init ?? a]
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// {"signature":"swift::IsObjCRequest::evaluate(swift::Evaluator&, swift::ValueDecl*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: objc_interop
4+
class a {
5+
@objc var b : Int {
6+
get throws {
7+
}
8+
set
9+
}
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// {"signature":"swift::GenericSignatureImpl::lookupNestedType(swift::Type, swift::Identifier) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
a.b
4+
protocol c where a.d == Self
5+
protocol a {
6+
associatedtype e : c
7+
typealias b
8+
typealias d = Self.f

0 commit comments

Comments
 (0)