blob: 9717de0de154a3e08b0c7022d99150a99d54a085 [file] [log] [blame]
// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
public protocol P {
associatedtype AT;
}
// A generic declcontext cannot be shared, so we expect a
// forward-declared type.
// CHECK-GEN: ![[FWD:.*]] = !DICompositeType({{.*}}, name: "Generic",
// CHECK-GEN-SAME: flags: DIFlagFwdDecl
// CHECK-GEN: linkageName: "_TFV4main7Generic3setfwx2ATT_", scope: ![[FWD]],
public struct Generic<T : P> {
public func get() -> T.AT? {
return nil
}
public func set(_ t: T.AT) {}
}
// But only one concrete type is expected.
// CHECK: !DISubprogram({{.*}}linkageName: "_TFV4main8Concrete3getfT_GSqSi_",
// CHECK-SAME: scope: ![[CONC:[0-9]+]],
// CHECK: ![[CONC]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Concrete", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, align: {{[0-9]+}}, elements: !{{[0-9]+}}, runtimeLang: DW_LANG_Swift, identifier: "_TtV4main8Concrete")
public struct Concrete {
public func get() -> Int? {
return nil
}
public func set(_ t: Int) {}
}
public func getConcrete() -> Concrete? { return nil; }