Skip to content

Commit 08ce5f5

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents f7971ee + c98aa53 commit 08ce5f5

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

lib/SILGen/SILGenType.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,14 @@ SILFunction *SILGenModule::emitProtocolWitness(
778778
// in a protocol extension, the generic signature will have an additional
779779
// generic parameter representing Self, so the generic parameters of the
780780
// class will all be shifted down by one.
781-
auto conformance = reqtSubMap.lookupConformance(M.getASTContext().TheSelfType,
782-
origConformance.getProtocol())
783-
.mapConformanceOutOfContext();
784-
ASSERT(conformance.isAbstract() == origConformance.isAbstract());
785-
781+
auto conformance = origConformance;
786782
ProtocolConformance *manglingConformance = nullptr;
787783
if (conformance.isConcrete()) {
784+
conformance = reqtSubMap.lookupConformance(M.getASTContext().TheSelfType,
785+
origConformance.getProtocol())
786+
.mapConformanceOutOfContext();
787+
ASSERT(!conformance.isAbstract());
788+
788789
manglingConformance = conformance.getConcrete();
789790
if (auto *inherited = dyn_cast<InheritedProtocolConformance>(manglingConformance)) {
790791
manglingConformance = inherited->getInheritedConformance();

test/SILGen/protocol_resilience.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ public protocol ResilientAssocTypes {
259259
associatedtype AssocType: P = ConformsToP
260260
}
261261

262+
// rdar://155798849 - This is a pointless protocol and conformance but it shouldn't crash
263+
public protocol SillyP: SillyC {
264+
func f()
265+
}
266+
267+
public class SillyC: SillyP {
268+
public func f() {}
269+
}
270+
262271
// CHECK-LABEL: sil_default_witness_table P {
263272
// CHECK-NEXT: }
264273

test/SILGen/typed_throws_async.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-emit-silgen %s
2+
3+
enum CustomError: Error {
4+
case error
5+
}
6+
7+
struct Test2<T> {
8+
init(_: T) async throws(CustomError) {}
9+
}
10+
11+
do {
12+
_ = try await Test2(1)
13+
} catch {
14+
print("\(error)")
15+
}

0 commit comments

Comments
 (0)