File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -267,8 +267,8 @@ static bool isTypeErasedGenericClassType(CanType type) {
267
267
}
268
268
269
269
// Get the type that exists at runtime to represent a compile-time type.
270
- static CanType
271
- getRuntimeReifiedType (IRGenModule &IGM, CanType type) {
270
+ CanType
271
+ irgen:: getRuntimeReifiedType (IRGenModule &IGM, CanType type) {
272
272
return CanType (type.transform ([&](Type t) -> Type {
273
273
if (isTypeErasedGenericClassType (CanType (t))) {
274
274
return t->getAnyNominal ()->getDeclaredType ()->getCanonicalType ();
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ namespace irgen {
85
85
CanType type,
86
86
SymbolReferenceKind refKind);
87
87
88
+ // / Get the type as it exists in Swift's runtime type system, removing any
89
+ // / erased generic parameters.
90
+ CanType getRuntimeReifiedType (IRGenModule &IGM, CanType type);
91
+
88
92
// / Emit a reference to a compile-time constant piece of heap metadata, or
89
93
// / return a null pointer if the type's heap metadata cannot be represented
90
94
// / by a constant.
Original file line number Diff line number Diff line change @@ -747,8 +747,10 @@ class IRGenSILFunction :
747
747
// Force all archetypes referenced by the type to be bound by this point.
748
748
// TODO: just make sure that we have a path to them that the debug info
749
749
// can follow.
750
- if (!IGM.IRGen .Opts .Optimize && Ty.getType ()->hasArchetype ())
751
- Ty.getType ()->getCanonicalType ().visit ([&](Type t) {
750
+ auto runtimeTy = getRuntimeReifiedType (IGM,
751
+ Ty.getType ()->getCanonicalType ());
752
+ if (!IGM.IRGen .Opts .Optimize && runtimeTy->hasArchetype ())
753
+ runtimeTy.visit ([&](Type t) {
752
754
if (auto archetype = dyn_cast<ArchetypeType>(CanType (t)))
753
755
emitTypeMetadataRef (archetype);
754
756
});
Original file line number Diff line number Diff line change
1
+
2
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -g -verify
3
+
4
+ // REQUIRES: objc_interop
5
+
6
+ import Swift
7
+ import Foundation
8
+ import objc_generics
9
+
10
+ extension GenericClass {
11
+ func method( ) { }
12
+ class func classMethod( ) { }
13
+ }
You can’t perform that action at this time.
0 commit comments