Skip to content

Commit 5897dbe

Browse files
committed
Update tests for deterministic serialization/printing of members
1 parent 76e6f15 commit 5897dbe

12 files changed

+57
-57
lines changed

test/AutoDiff/Sema/DerivedConformances/derived_differentiable.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ struct GenericTangentVectorMember<T: Differentiable>: Differentiable,
1010

1111
// CHECK-AST-LABEL: internal struct GenericTangentVectorMember<T> : {{(Differentiable, AdditiveArithmetic)|(AdditiveArithmetic, Differentiable)}} where T : Differentiable
1212
// CHECK-AST: internal var x: T.TangentVector
13-
// CHECK-AST: internal init(x: T.TangentVector)
14-
// CHECK-AST: internal typealias TangentVector = GenericTangentVectorMember<T>
15-
// CHECK-AST: internal static var zero: GenericTangentVectorMember<T> { get }
1613
// CHECK-AST: internal static func + (lhs: GenericTangentVectorMember<T>, rhs: GenericTangentVectorMember<T>) -> GenericTangentVectorMember<T>
1714
// CHECK-AST: internal static func - (lhs: GenericTangentVectorMember<T>, rhs: GenericTangentVectorMember<T>) -> GenericTangentVectorMember<T>
1815
// CHECK-AST: @_implements(Equatable, ==(_:_:)) internal static func __derived_struct_equals(_ a: GenericTangentVectorMember<T>, _ b: GenericTangentVectorMember<T>) -> Bool
16+
// CHECK-AST: internal typealias TangentVector = GenericTangentVectorMember<T>
17+
// CHECK-AST: internal init(x: T.TangentVector)
18+
// CHECK-AST: internal static var zero: GenericTangentVectorMember<T> { get }
1919

2020
public struct ConditionallyDifferentiable<T> {
2121
public var x: T
@@ -69,17 +69,17 @@ final class AdditiveArithmeticClass<T: AdditiveArithmetic & Differentiable>: Add
6969
public struct FrozenStruct: Differentiable {}
7070

7171
// CHECK-AST-LABEL: @frozen public struct FrozenStruct : Differentiable {
72-
// CHECK-AST: internal init()
7372
// CHECK-AST: @frozen public struct TangentVector : {{(Differentiable, AdditiveArithmetic)|(AdditiveArithmetic, Differentiable)}} {
73+
// CHECK-AST: internal init()
7474

7575
@usableFromInline
7676
struct UsableFromInlineStruct: Differentiable {}
7777

7878
// CHECK-AST-LABEL: @usableFromInline
7979
// CHECK-AST: struct UsableFromInlineStruct : Differentiable {
80-
// CHECK-AST: internal init()
8180
// CHECK-AST: @usableFromInline
8281
// CHECK-AST: struct TangentVector : {{(Differentiable, AdditiveArithmetic)|(AdditiveArithmetic, Differentiable)}} {
82+
// CHECK-AST: internal init()
8383

8484
// Test property wrappers.
8585

test/IDE/print_ast_tc_decls.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ struct d0100_FooStruct {
241241
static func overloadedStaticFunc2(x: Double) -> Int { return 0 }
242242
// PASS_COMMON-NEXT: {{^}} static func overloadedStaticFunc2(x: Double) -> Int{{$}}
243243
}
244-
// PASS_COMMON-NEXT: {{^}} init(instanceVar1: Int = 0){{$}}
245244
// PASS_COMMON-NEXT: {{^}} init(){{$}}
245+
// PASS_COMMON-NEXT: {{^}} init(instanceVar1: Int = 0){{$}}
246246
// PASS_COMMON-NEXT: {{^}}}{{$}}
247247

248248
extension d0100_FooStruct {
@@ -596,8 +596,8 @@ struct d0200_EscapedIdentifiers {
596596
// PASS_COMMON-NEXT: {{^}} enum `enum` {{{$}}
597597
// PASS_COMMON-NEXT: {{^}} case `case`{{$}}
598598
// PASS_COMMON-NEXT: {{^}} {{.*}}static func __derived_enum_equals(_ a: d0200_EscapedIdentifiers.`enum`, _ b: d0200_EscapedIdentifiers.`enum`) -> Bool
599-
// PASS_COMMON-NEXT: {{^}} var hashValue: Int { get }{{$}}
600599
// PASS_COMMON-NEXT: {{^}} func hash(into hasher: inout Hasher)
600+
// PASS_COMMON-NEXT: {{^}} var hashValue: Int { get }{{$}}
601601
// PASS_COMMON-NEXT: {{^}} }{{$}}
602602

603603
class `class` {}
@@ -613,8 +613,8 @@ struct d0200_EscapedIdentifiers {
613613
class `extension` : `class` {}
614614
// PASS_ONE_LINE_TYPE-DAG: {{^}} @_inheritsConvenienceInitializers class `extension` : d0200_EscapedIdentifiers.`class` {{{$}}
615615
// PASS_ONE_LINE_TYPEREPR-DAG: {{^}} @_inheritsConvenienceInitializers class `extension` : `class` {{{$}}
616-
// PASS_COMMON: {{^}} @objc deinit{{$}}
617-
// PASS_COMMON-NEXT: {{^}} {{(override )?}}init(){{$}}
616+
// PASS_COMMON: {{^}} {{(override )?}}init(){{$}}
617+
// PASS_COMMON-NEXT: {{^}} @objc deinit{{$}}
618618
// PASS_COMMON-NEXT: {{^}} }{{$}}
619619

620620
func `func`<`let`: `protocol`, `where`>(
@@ -1025,8 +1025,8 @@ enum d2000_EnumDecl1 {
10251025
// PASS_COMMON-NEXT: {{^}} case ED1_First{{$}}
10261026
// PASS_COMMON-NEXT: {{^}} case ED1_Second{{$}}
10271027
// PASS_COMMON-NEXT: {{^}} {{.*}}static func __derived_enum_equals(_ a: d2000_EnumDecl1, _ b: d2000_EnumDecl1) -> Bool
1028-
// PASS_COMMON-NEXT: {{^}} var hashValue: Int { get }{{$}}
10291028
// PASS_COMMON-NEXT: {{^}} func hash(into hasher: inout Hasher)
1029+
// PASS_COMMON-NEXT: {{^}} var hashValue: Int { get }{{$}}
10301030
// PASS_COMMON-NEXT: {{^}}}{{$}}
10311031

10321032
enum d2100_EnumDecl2 {
@@ -1179,8 +1179,8 @@ struct d2800_ProtocolWithAssociatedType1Impl : d2700_ProtocolWithAssociatedType1
11791179

11801180
// PASS_COMMON: {{^}}struct d2800_ProtocolWithAssociatedType1Impl : d2700_ProtocolWithAssociatedType1 {{{$}}
11811181
// PASS_COMMON-NEXT: {{^}} func returnsTA1() -> Int{{$}}
1182-
// PASS_COMMON-NEXT: {{^}} init(){{$}}
11831182
// PASS_COMMON-NEXT: {{^}} typealias TA1 = Int
1183+
// PASS_COMMON-NEXT: {{^}} init(){{$}}
11841184
// PASS_COMMON-NEXT: {{^}}}{{$}}
11851185

11861186
//===---

test/ModuleInterface/inherited-generic-parameters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public class Base<In, Out> {
2626

2727
// CHECK: public class Derived<T> : {{(main.)?}}Base<T, T> {
2828
public class Derived<T> : Base<T, T> {
29-
// CHECK-NEXT: {{(@objc )?}}deinit
3029
// CHECK-NEXT: override public init(x: @escaping (T) -> T)
3130
// CHECK-NEXT: override public init<A>(_ argument: A, _ argument: A)
3231
// CHECK-NEXT: override public init<C>(_ argument: C) where C : main.Base<T, T>
32+
// CHECK-NEXT: {{(@objc )?}}deinit
3333
// CHECK-NEXT: }
3434
}
3535

test/ModuleInterface/modifiers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public class Base {
6868

6969
// CHECK-LABEL: public class SubImplicit : {{(Test[.])?Base}} {
7070
public class SubImplicit: Base {
71-
// CHECK-NEXT: @objc deinit{{$}}
7271
// CHECK-NEXT: @objc override public init(){{$}}
7372
// CHECK-NEXT: @objc required public init(x: Swift.Int){{$}}
73+
// CHECK-NEXT: @objc deinit{{$}}
7474
} // CHECK-NEXT: {{^}$}}
7575

7676

test/SILGen/deterministic-dtor-ordering.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
public class Horse {}
55

6-
// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s5horse5HorseCACycfC : $@convention(method) (@thick Horse.Type) -> @owned Horse {
7-
// CHECK-LABEL: sil hidden [ossa] @$s5horse5HorseCACycfc : $@convention(method) (@owned Horse) -> @owned Horse {
86
// CHECK-LABEL: sil [ossa] @$s5horse5HorseCfd : $@convention(method) (@guaranteed Horse) -> @owned Builtin.NativeObject {
97
// CHECK-LABEL: sil [ossa] @$s5horse5HorseCfD : $@convention(method) (@owned Horse) -> () {
8+
// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s5horse5HorseCACycfC : $@convention(method) (@thick Horse.Type) -> @owned Horse {
9+
// CHECK-LABEL: sil hidden [ossa] @$s5horse5HorseCACycfc : $@convention(method) (@owned Horse) -> @owned Horse {
1010

test/SILGen/synthesized_conformance_class.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ final class Final<T> {
88
// CHECK-LABEL: final class Final<T> {
99
// CHECK: @_hasStorage final var x: T { get set }
1010
// CHECK: init(x: T)
11-
// CHECK: deinit
1211
// CHECK: enum CodingKeys : CodingKey {
1312
// CHECK: case x
1413
// CHECK: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: Final<T>.CodingKeys, _ b: Final<T>.CodingKeys) -> Bool
15-
// CHECK: var hashValue: Int { get }
1614
// CHECK: func hash(into hasher: inout Hasher)
17-
// CHECK: var stringValue: String { get }
1815
// CHECK: init?(stringValue: String)
19-
// CHECK: var intValue: Int? { get }
2016
// CHECK: init?(intValue: Int)
17+
// CHECK: var hashValue: Int { get }
18+
// CHECK: var intValue: Int? { get }
19+
// CHECK: var stringValue: String { get }
2120
// CHECK: }
21+
// CHECK: deinit
2222
// CHECK: }
2323

2424
class Nonfinal<T> {
@@ -28,17 +28,17 @@ class Nonfinal<T> {
2828
// CHECK-LABEL: class Nonfinal<T> {
2929
// CHECK: @_hasStorage var x: T { get set }
3030
// CHECK: init(x: T)
31-
// CHECK: deinit
3231
// CHECK: enum CodingKeys : CodingKey {
3332
// CHECK: case x
3433
// CHECK: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: Nonfinal<T>.CodingKeys, _ b: Nonfinal<T>.CodingKeys) -> Bool
35-
// CHECK: var hashValue: Int { get }
3634
// CHECK: func hash(into hasher: inout Hasher)
37-
// CHECK: var stringValue: String { get }
3835
// CHECK: init?(stringValue: String)
39-
// CHECK: var intValue: Int? { get }
4036
// CHECK: init?(intValue: Int)
37+
// CHECK: var hashValue: Int { get }
38+
// CHECK: var intValue: Int? { get }
39+
// CHECK: var stringValue: String { get }
4140
// CHECK: }
41+
// CHECK: deinit
4242
// CHECK: }
4343

4444
// CHECK-LABEL: extension Final : Encodable where T : Encodable {

test/SILGen/synthesized_conformance_enum.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ enum NoValues {
1515
// CHECK: case a, b
1616
// CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: NoValues, _ b: NoValues) -> Bool
1717
// CHECK-RESILIENT: static func == (a: NoValues, b: NoValues) -> Bool
18-
// CHECK: var hashValue: Int { get }
1918
// CHECK: func hash(into hasher: inout Hasher)
19+
// CHECK: var hashValue: Int { get }
2020
// CHECK: }
2121

2222
// CHECK-LABEL: extension Enum : Equatable where T : Equatable {
2323
// CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: Enum<T>, _ b: Enum<T>) -> Bool
2424
// CHECK-RESILIENT: static func == (a: Enum<T>, b: Enum<T>) -> Bool
2525
// CHECK: }
2626
// CHECK-LABEL: extension Enum : Hashable where T : Hashable {
27-
// CHECK: var hashValue: Int { get }
2827
// CHECK: func hash(into hasher: inout Hasher)
28+
// CHECK: var hashValue: Int { get }
2929
// CHECK: }
3030

3131
// CHECK-LABEL: extension NoValues : CaseIterable {

test/SILGen/synthesized_conformance_struct.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ struct Struct<T> {
77

88
// CHECK-LABEL: struct Struct<T> {
99
// CHECK: @_hasStorage var x: T { get set }
10-
// CHECK: init(x: T)
1110
// CHECK: enum CodingKeys : CodingKey {
1211
// CHECK: case x
1312
// CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_enum_equals(_ a: Struct<T>.CodingKeys, _ b: Struct<T>.CodingKeys) -> Bool
1413
// CHECK-RESILIENT: static func == (a: Struct<T>.CodingKeys, b: Struct<T>.CodingKeys) -> Bool
15-
// CHECK: var hashValue: Int { get }
1614
// CHECK: func hash(into hasher: inout Hasher)
17-
// CHECK: var stringValue: String { get }
1815
// CHECK: init?(stringValue: String)
19-
// CHECK: var intValue: Int? { get }
2016
// CHECK: init?(intValue: Int)
17+
// CHECK: var hashValue: Int { get }
18+
// CHECK: var intValue: Int? { get }
19+
// CHECK: var stringValue: String { get }
2120
// CHECK: }
21+
// CHECK: init(x: T)
2222
// CHECK: }
2323
// CHECK-LABEL: extension Struct : Equatable where T : Equatable {
2424
// CHECK-FRAGILE: @_implements(Equatable, ==(_:_:)) static func __derived_struct_equals(_ a: Struct<T>, _ b: Struct<T>) -> Bool
2525
// CHECK-RESILIENT: static func == (a: Struct<T>, b: Struct<T>) -> Bool
2626
// CHECK: }
2727
// CHECK-LABEL: extension Struct : Hashable where T : Hashable {
28-
// CHECK: var hashValue: Int { get }
2928
// CHECK: func hash(into hasher: inout Hasher)
29+
// CHECK: var hashValue: Int { get }
3030
// CHECK: }
3131
// CHECK-LABEL: extension Struct : Decodable & Encodable where T : Decodable, T : Encodable {
32-
// CHECK: init(from decoder: Decoder) throws
3332
// CHECK: func encode(to encoder: Encoder) throws
33+
// CHECK: init(from decoder: Decoder) throws
3434
// CHECK: }
3535

3636
extension Struct: Equatable where T: Equatable {}

test/Serialization/attr-actorindependent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
// look for correct annotation after first deserialization's module print:
1515

1616
// MODULE-CHECK: actor class UnsafeCounter {
17+
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) func enqueue(partialTask: PartialAsyncTask)
1718
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) var storage: Int
1819
// MODULE-CHECK-NEXT: @actorIndependent var count: Int
1920
// MODULE-CHECK-NEXT: var actorCount: Int
20-
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) func enqueue(partialTask: PartialAsyncTask)
2121
// MODULE-CHECK-NEXT: init()
2222
// MODULE-CHECK-NEXT: }
2323

test/api-digester/Outputs/cake.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -538,23 +538,6 @@
538538
"usr": "s:4cake6NumberO3oneyA2CmF",
539539
"moduleName": "cake"
540540
},
541-
{
542-
"kind": "TypeAlias",
543-
"name": "RawValue",
544-
"printedName": "RawValue",
545-
"children": [
546-
{
547-
"kind": "TypeNominal",
548-
"name": "Int",
549-
"printedName": "Swift.Int",
550-
"usr": "s:Si"
551-
}
552-
],
553-
"declKind": "TypeAlias",
554-
"usr": "s:4cake6NumberO8RawValuea",
555-
"moduleName": "cake",
556-
"implicit": true
557-
},
558541
{
559542
"kind": "Constructor",
560543
"name": "init",
@@ -590,6 +573,23 @@
590573
],
591574
"init_kind": "Designated"
592575
},
576+
{
577+
"kind": "TypeAlias",
578+
"name": "RawValue",
579+
"printedName": "RawValue",
580+
"children": [
581+
{
582+
"kind": "TypeNominal",
583+
"name": "Int",
584+
"printedName": "Swift.Int",
585+
"usr": "s:Si"
586+
}
587+
],
588+
"declKind": "TypeAlias",
589+
"usr": "s:4cake6NumberO8RawValuea",
590+
"moduleName": "cake",
591+
"implicit": true
592+
},
593593
{
594594
"kind": "Var",
595595
"name": "rawValue",

test/attr/accessibility_print.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ struct BA_DefaultStruct {
2929
private struct BB_PrivateStruct {
3030
// CHECK: internal var x
3131
var x = 0
32-
// CHECK: internal init(x: Int = 0)
3332
// CHECK: internal init()
33+
// CHECK: internal init(x: Int = 0)
3434
} // CHECK: {{^[}]}}
3535

3636
// CHECK-LABEL: internal{{(\*/)?}} struct BC_InternalStruct {
@@ -44,24 +44,24 @@ internal struct BC_InternalStruct {
4444
public struct BD_PublicStruct {
4545
// CHECK: internal var x
4646
var x = 0
47-
// CHECK: internal init(x: Int = 0)
4847
// CHECK: internal init()
48+
// CHECK: internal init(x: Int = 0)
4949
} // CHECK: {{^[}]}}
5050

5151
// CHECK-LABEL: public{{(\*/)?}} struct BE_PublicStructPrivateMembers {
5252
public struct BE_PublicStructPrivateMembers {
5353
// CHECK: private{{(\*/)?}} var x
5454
private var x = 0
55-
// CHECK: private init(x: Int = 0)
5655
// CHECK: internal init()
56+
// CHECK: private init(x: Int = 0)
5757
} // CHECK: {{^[}]}}
5858

5959
// CHECK-LABEL: {{^}}fileprivate{{(\*/)?}} struct BF_FilePrivateStruct {
6060
fileprivate struct BF_FilePrivateStruct {
6161
// CHECK: {{^}} internal var x
6262
var x = 0
63-
// CHECK: {{^}} internal init(x: Int = 0)
6463
// CHECK: {{^}} internal init()
64+
// CHECK: {{^}} internal init(x: Int = 0)
6565
} // CHECK: {{^[}]}}
6666

6767

@@ -337,16 +337,16 @@ fileprivate protocol IB_FilePrivateAssocTypeProto {
337337
public class IC_PublicAssocTypeImpl: IA_PublicAssocTypeProto, IB_FilePrivateAssocTypeProto {
338338
public var publicValue: Int = 0
339339
public var filePrivateValue: Int = 0
340-
// CHECK-DAG: {{^}} public typealias PublicValue
341340
// CHECK-DAG: {{^}} public typealias FilePrivateValue
341+
// CHECK-DAG: {{^}} public typealias PublicValue
342342
} // CHECK: {{^[}]}}
343343

344344
// CHECK-LABEL: private{{(\*/)?}} class ID_PrivateAssocTypeImpl : IA_PublicAssocTypeProto, IB_FilePrivateAssocTypeProto {
345345
private class ID_PrivateAssocTypeImpl: IA_PublicAssocTypeProto, IB_FilePrivateAssocTypeProto {
346346
public var publicValue: Int = 0
347347
public var filePrivateValue: Int = 0
348-
// CHECK-DAG: {{^}} fileprivate typealias PublicValue
349348
// CHECK-DAG: {{^}} fileprivate typealias FilePrivateValue
349+
// CHECK-DAG: {{^}} fileprivate typealias PublicValue
350350
} // CHECK: {{^[}]}}
351351

352352
// CHECK-LABEL: class MultipleAttributes {

test/attr/accessibility_print_inferred_type_witnesses.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ fileprivate protocol FilePrivateAssocTypeProto {
2727
private class PrivateImpl: PublicAssocTypeProto, FilePrivateAssocTypeProto {
2828
fileprivate var publicValue: InternalStruct?
2929
fileprivate var filePrivateValue: Int?
30-
// CHECK-DAG: {{^}} fileprivate typealias PublicValue
3130
// CHECK-DAG: {{^}} fileprivate typealias FilePrivateValue
31+
// CHECK-DAG: {{^}} fileprivate typealias PublicValue
3232
} // CHECK: {{^[}]}}
3333

3434
// CHECK-LABEL: public{{(\*/)?}} class PublicImpl : PublicAssocTypeProto, FilePrivateAssocTypeProto {
3535
public class PublicImpl: PublicAssocTypeProto, FilePrivateAssocTypeProto {
3636
public var publicValue: Int?
3737
fileprivate var filePrivateValue: InternalStruct?
3838
// CHECK-DAG: {{^}} public typealias PublicValue
39-
// CHECK-4-DAG: {{^}} internal typealias FilePrivateValue
4039
// CHECK-5-DAG: {{^}} fileprivate typealias FilePrivateValue
40+
// CHECK-4-DAG: {{^}} internal typealias FilePrivateValue
4141
} // CHECK: {{^[}]}}

0 commit comments

Comments
 (0)