File tree Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -778,13 +778,14 @@ SILFunction *SILGenModule::emitProtocolWitness(
778
778
// in a protocol extension, the generic signature will have an additional
779
779
// generic parameter representing Self, so the generic parameters of the
780
780
// 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;
786
782
ProtocolConformance *manglingConformance = nullptr ;
787
783
if (conformance.isConcrete ()) {
784
+ conformance = reqtSubMap.lookupConformance (M.getASTContext ().TheSelfType ,
785
+ origConformance.getProtocol ())
786
+ .mapConformanceOutOfContext ();
787
+ ASSERT (!conformance.isAbstract ());
788
+
788
789
manglingConformance = conformance.getConcrete ();
789
790
if (auto *inherited = dyn_cast<InheritedProtocolConformance>(manglingConformance)) {
790
791
manglingConformance = inherited->getInheritedConformance ();
Original file line number Diff line number Diff line change @@ -259,6 +259,15 @@ public protocol ResilientAssocTypes {
259
259
associatedtype AssocType : P = ConformsToP
260
260
}
261
261
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
+
262
271
// CHECK-LABEL: sil_default_witness_table P {
263
272
// CHECK-NEXT: }
264
273
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments