Skip to content

Commit fdd74cc

Browse files
authored
Merge pull request #9973 from slavapestov/fix-a-crash-and-add-more-crashers
Fix a crash and add more crashers
2 parents 4468ad2 + 7af399f commit fdd74cc

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,7 +2957,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
29572957
return result.markErrorAlreadyDiagnosed();
29582958

29592959
// FIXME: Deal with broken recursion
2960-
if (!ctor->getInterfaceType())
2960+
if (!ctor->hasInterfaceType())
29612961
continue;
29622962

29632963
// If the argument labels for this result are incompatible with
@@ -3054,7 +3054,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
30543054
}
30553055

30563056
// FIXME: Deal with broken recursion
3057-
if (!cand->getInterfaceType())
3057+
if (!cand->hasInterfaceType())
30583058
return;
30593059

30603060
// If the argument labels for this result are incompatible with
@@ -3241,7 +3241,11 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
32413241
result.markErrorAlreadyDiagnosed();
32423242
return result;
32433243
}
3244-
3244+
3245+
// FIXME: Deal with broken recursion
3246+
if (!cand->hasInterfaceType())
3247+
continue;
3248+
32453249
result.addUnviable(cand, MemberLookupResult::UR_Inaccessible);
32463250
}
32473251
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: not --crash %target-swift-frontend -emit-ir -primary-file %s
2+
3+
internal protocol _UTFEncoding {
4+
associatedtype EncodedScalar where EncodedScalar == Int
5+
}
6+
7+
public protocol _UnicodeEncoding {
8+
associatedtype EncodedScalar : BidirectionalCollection
9+
}
10+
11+
public protocol _UnicodeEncoding_ {
12+
associatedtype ForwardParser: _UnicodeEncoding
13+
}
14+
15+
public protocol UnicodeEncoding: _UnicodeEncoding_ where ForwardParser == Self {}
16+
17+
public protocol _UTFParser {
18+
associatedtype Encoding: UnicodeEncoding, _UTFEncoding
19+
}
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 -emit-ir -primary-file %s
2+
3+
struct Version {
4+
}
5+
6+
extension CountableRange where Bound == Version {
7+
func contains(_ element: Version) -> Bool {
8+
fatalError()
9+
}
10+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: not %target-swift-frontend -typecheck -primary-file %s
2+
3+
public struct _UIntBuffer<Storage, Element> {
4+
var _storage: Storage
5+
var _bitCount: UInt8
6+
}
7+
8+
protocol _UTFDecoder {
9+
associatedtype BufferStorage
10+
associatedtype CodeUnit
11+
12+
var buffer: _UIntBuffer<BufferStorage, CodeUnit> { get set }
13+
}
14+
15+
public struct ReverseDecoder : _UTFDecoder {
16+
public typealias Buffer = _UIntBuffer<BufferStorage, UInt8>
17+
public var buffer = Buffer()
18+
public init() {}
19+
}

0 commit comments

Comments
 (0)