// RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 | %FileCheck -check-prefix CHECK -check-prefix CHECK-FRAGILE %s // RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 -enable-library-evolution | %FileCheck -check-prefix CHECK -check-prefix CHECK-RESILIENT %s struct Struct { var x: T } // CHECK-LABEL: struct Struct { // CHECK: @_hasStorage var x: T { get set } // CHECK: enum CodingKeys : CodingKey { // CHECK: case x // CHECK: init?(stringValue: String) // CHECK: init?(intValue: Int) // CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: Struct.CodingKeys, _ b: Struct.CodingKeys) -> Bool // CHECK-RESILIENT: static func == (a: Struct.CodingKeys, b: Struct.CodingKeys) -> Bool // CHECK: func hash(into hasher: inout Hasher) // CHECK: var hashValue: Int { get } // CHECK: var intValue: Int? { get } // CHECK: var stringValue: String { get } // CHECK: } // CHECK: init(x: T) // CHECK: } // CHECK-LABEL: extension Struct : Equatable where T : Equatable { // CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_struct_equals(_ a: Struct, _ b: Struct) -> Bool // CHECK-RESILIENT: static func == (a: Struct, b: Struct) -> Bool // CHECK: } // CHECK-LABEL: extension Struct : Hashable where T : Hashable { // CHECK: func hash(into hasher: inout Hasher) // CHECK: var hashValue: Int { get } // CHECK: } // CHECK-LABEL: extension Struct : Decodable & Encodable where T : Decodable, T : Encodable { // CHECK: func encode(to encoder: any Encoder) throws // CHECK: init(from decoder: any Decoder) throws // CHECK: } extension Struct: Equatable where T: Equatable {} // CHECK-FRAGILE-LABEL: // static Struct.__derived_struct_equals(_:_:) // CHECK-FRAGILE-NEXT: // Isolation: unspecified // CHECK-FRAGILE-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASQRzlE010__derived_C7_equalsySbACyxG_AEtFZ : $@convention(method) (@in_guaranteed Struct, @in_guaranteed Struct, @thin Struct.Type) -> Bool { // CHECK-RESILIENT-LABEL: // static Struct.== infix(_:_:) // CHECK-RESILIENT-NEXT: // Isolation: unspecified // CHECK-RESILIENT-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASQRzlE2eeoiySbACyxG_AEtFZ : $@convention(method) (@in_guaranteed Struct, @in_guaranteed Struct, @thin Struct.Type) -> Bool { extension Struct: Hashable where T: Hashable {} // CHECK-LABEL: // Struct.hash(into:) // CHECK-NEXT: // Isolation: unspecified // CHECK-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASHRzlE4hash4intoys6HasherVz_tF : $@convention(method) (@inout Hasher, @in_guaranteed Struct) -> () { // CHECK-LABEL: // Struct.hashValue.getter // CHECK-NEXT: // Isolation: unspecified // CHECK-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASHRzlE9hashValueSivg : $@convention(method) (@in_guaranteed Struct) -> Int { extension Struct: Codable where T: Codable {} // CHECK-LABEL: // Struct.encode(to:) // CHECK-NEXT: // Isolation: unspecified // CHECK-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASeRzSERzlE6encode2toys7Encoder_p_tKF : $@convention(method) (@in_guaranteed any Encoder, @in_guaranteed Struct) -> @error any Error { // CHECK-LABEL: // Struct.init(from:) // CHECK-NEXT: // Isolation: unspecified // CHECK-NEXT: sil hidden [ossa] @$s30synthesized_conformance_struct6StructVAASeRzSERzlE4fromACyxGs7Decoder_p_tKcfC : $@convention(method) (@in any Decoder, @thin Struct.Type) -> (@out Struct, @error any Error) // Witness tables // CHECK-LABEL: sil_witness_table hidden Struct: Equatable module synthesized_conformance_struct { // CHECK-NEXT: method #Equatable."==": (Self.Type) -> (Self, Self) -> Bool : @$s30synthesized_conformance_struct6StructVyxGSQAASQRzlSQ2eeoiySbx_xtFZTW // protocol witness for static Equatable.== infix(_:_:) in conformance Struct // CHECK-NEXT: conditional_conformance (T: Equatable): dependent // CHECK-NEXT: } // CHECK-LABEL: sil_witness_table hidden Struct: Hashable module synthesized_conformance_struct { // CHECK-DAG: base_protocol Equatable: Struct: Equatable module synthesized_conformance_struct // CHECK-DAG: method #Hashable.hashValue!getter: (Self) -> () -> Int : @$s30synthesized_conformance_struct6StructVyxGSHAASHRzlSH9hashValueSivgTW // protocol witness for Hashable.hashValue.getter in conformance Struct // CHECK-DAG: method #Hashable.hash: (Self) -> (inout Hasher) -> () : @$s30synthesized_conformance_struct6StructVyxGSHAASHRzlSH4hash4intoys6HasherVz_tFTW // protocol witness for Hashable.hash(into:) in conformance Struct // CHECK-DAG: method #Hashable._rawHashValue: (Self) -> (Int) -> Int : @$s30synthesized_conformance_struct6StructVyxGSHAASHRzlSH13_rawHashValue4seedS2i_tFTW // protocol witness for Hashable._rawHashValue(seed:) in conformance Struct // CHECK-DAG: conditional_conformance (T: Hashable): dependent // CHECK: } // CHECK-LABEL: sil_witness_table hidden Struct: Decodable module synthesized_conformance_struct { // CHECK-NEXT: method #Decodable.init!allocator: (Self.Type) -> (any Decoder) throws -> Self : @$s30synthesized_conformance_struct6StructVyxGSeAASeRzSERzlSe4fromxs7Decoder_p_tKcfCTW // protocol witness for Decodable.init(from:) in conformance Struct // CHECK-NEXT: conditional_conformance (T: Decodable): dependent // CHECK-NEXT: conditional_conformance (T: Encodable): dependent // CHECK-NEXT: } // CHECK-LABEL: sil_witness_table hidden Struct: Encodable module synthesized_conformance_struct { // CHECK-NEXT: method #Encodable.encode: (Self) -> (any Encoder) throws -> () : @$s30synthesized_conformance_struct6StructVyxGSEAASeRzSERzlSE6encode2toys7Encoder_p_tKFTW // protocol witness for Encodable.encode(to:) in conformance Struct // CHECK-NEXT: conditional_conformance (T: Decodable): dependent // CHECK-NEXT: conditional_conformance (T: Encodable): dependent // CHECK-NEXT: }