Skip to content

Commit 7af399f

Browse files
committed
Sema: Change a getInterfaceType() to hasInterfaceType() in a couple of places
ValueDecl::getInterfaceType() asserts if the decl has no interface type; to check if the declaration has been type checked yet, use hasInterfaceType(). Fixes <https://bugs.swift.org/browse/SR-4743>.
1 parent 5a89442 commit 7af399f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-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 %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)