Files
swift-mirror/test/IRGen/objc_generic_class_convention.sil
2023-06-21 10:10:32 -07:00

27 lines
952 B
Plaintext

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s
// REQUIRES: objc_interop
sil_stage canonical
import Swift
import Foundation
import objc_generics
// If we define a method on an ObjC generic class in Swift, we don't have
// access to Self's type parameters, and shouldn't try to emit type parameters
// for them either, since they wouldn't be available through the polymorphic
// convention for class methods.
// CHECK-LABEL: define swiftcc void @method(i64 %0, ptr swiftself %1)
sil @method : $@convention(method) @pseudogeneric <T: AnyObject> (Int64, @guaranteed GenericClass<T>) -> () {
entry(%0 : $Int64, %1 : $GenericClass<T>):
return undef : $()
}
// CHECK-LABEL: define void @objcMethod(ptr %0, ptr %1, i64 %2)
sil @objcMethod : $@convention(objc_method) @pseudogeneric <T: AnyObject> (Int64, @guaranteed GenericClass<T>) -> () {
entry(%0 : $Int64, %1 : $GenericClass<T>):
return undef : $()
}