Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make swift types public and deprecations prettier #91

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golden/swiftAdvancedEnumSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum Enum: CaseIterable, Hashable, Codable {
public enum Enum: CaseIterable, Hashable, Codable {
case a
case b
case c
Expand Down
2 changes: 1 addition & 1 deletion .golden/swiftAdvancedEnumWithRawValueSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum Enum: String, CaseIterable, Hashable, Codable {
public enum Enum: String, CaseIterable, Hashable, Codable {
case a
case b
}
6 changes: 3 additions & 3 deletions .golden/swiftAdvancedNewtypeSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Newtype: CaseIterable, Hashable, Codable {
typealias NewtypeTag = Tagged<Newtype, String>
let value: NewtypeTag
public struct Newtype: CaseIterable, Hashable, Codable {
public typealias NewtypeTag = Tagged<Newtype, String>
public let value: NewtypeTag
}
4 changes: 2 additions & 2 deletions .golden/swiftAdvancedNewtypeWithEnumFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct Newtype {
var newtypeField: Enum
public struct Newtype {
public var newtypeField: Enum
}
6 changes: 3 additions & 3 deletions .golden/swiftAdvancedRecordSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Data: CaseIterable, Hashable, Codable {
var field0: Int
var field1: Int?
public struct Data: CaseIterable, Hashable, Codable {
public var field0: Int
public var field1: Int?
}
6 changes: 3 additions & 3 deletions .golden/swiftBasicDocSpec/golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
/// guard n != 0, n != 1 else { return n }
/// return fibonacci(n - 1) + fibonacci(n - 2)
/// }
struct Data {
public struct Data {
/// First field, it's an Int
var first: Int
public var first: Int
/// Second field, it's maybe an Int
var second: Int?
public var second: Int?
}
2 changes: 1 addition & 1 deletion .golden/swiftBasicEnumSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum Enum {
public enum Enum {
case a
case b
case c
Expand Down
2 changes: 1 addition & 1 deletion .golden/swiftBasicEnumWithRawValueSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum Enum {
public enum Enum {
case a
case b
}
6 changes: 3 additions & 3 deletions .golden/swiftBasicNewtypeJoinOptionalsSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Newtype {
typealias NewtypeTag = Tagged<Newtype, Int?>
let value: NewtypeTag?
public struct Newtype {
public typealias NewtypeTag = Tagged<Newtype, Int?>
public let value: NewtypeTag?
}
6 changes: 3 additions & 3 deletions .golden/swiftBasicNewtypeSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Newtype {
typealias NewtypeTag = Tagged<Newtype, String>
let value: NewtypeTag
public struct Newtype {
public typealias NewtypeTag = Tagged<Newtype, String>
public let value: NewtypeTag
}
4 changes: 2 additions & 2 deletions .golden/swiftBasicNewtypeWithConcreteFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct Newtype {
var newtypeField: String
public struct Newtype {
public var newtypeField: String
}
4 changes: 2 additions & 2 deletions .golden/swiftBasicNewtypeWithEitherFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct Newtype {
var newtypeField: Result<Int, String>
public struct Newtype {
public var newtypeField: Result<Int, String>
}
6 changes: 3 additions & 3 deletions .golden/swiftBasicRecordSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Data {
var field0: Int
var field1: Int?
public struct Data {
public var field0: Int
public var field1: Int?
}
2 changes: 1 addition & 1 deletion .golden/swiftDataSingleNullarySpec/golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
struct Data: Hashable, Codable {}
public struct Data: Hashable, Codable {}
2 changes: 1 addition & 1 deletion .golden/swiftDataSingleNullaryWithTypeVariableSpec/golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
struct Data<A: Hashable & Codable>: Hashable, Codable {}
public struct Data<A: Hashable & Codable>: Hashable, Codable {}
8 changes: 4 additions & 4 deletions .golden/swiftDeprecatedFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct Data {
var field0: Int
// Deprecated since build 500
// var field1: Int?
public struct Data {
public var field0: Int
// Deprecated since build 500
// public var field1: Int?
}
8 changes: 4 additions & 4 deletions .golden/swiftEnumSumOfProductDocSpec/golden
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/// Top-level documentation describing ``Enum``.
enum Enum: CaseIterable, Hashable, Codable {
public enum Enum: CaseIterable, Hashable, Codable {
/// A constructor.
case dataCons0(Record0)
/// Another constructor.
case dataCons1(Record1)

enum CodingKeys: String, CodingKey {
public enum CodingKeys: String, CodingKey {
case tag
case contents
}

init(from decoder: any Decoder) throws {
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let discriminator = try container.decode(String.self, forKey: .tag)
switch discriminator {
Expand All @@ -26,7 +26,7 @@ enum Enum: CaseIterable, Hashable, Codable {
}
}

func encode(to encoder: any Encoder) throws {
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch (self) {
case let .dataCons0(contents):
Expand Down
8 changes: 4 additions & 4 deletions .golden/swiftEnumSumOfProductSpec/golden
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
enum Enum: Hashable, Codable {
public enum Enum: Hashable, Codable {
case dataCons0(_ enumField0: Int, _ enumField1: Int)
case dataCons1(_ enumField2: String, _ enumField3: String)

enum CodingKeys: String, CodingKey {
public enum CodingKeys: String, CodingKey {
case tag
case enumField0
case enumField1
case enumField2
case enumField3
}

init(from decoder: any Decoder) throws {
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let discriminator = try container.decode(String.self, forKey: .tag)
switch discriminator {
Expand All @@ -32,7 +32,7 @@ enum Enum: Hashable, Codable {
}
}

func encode(to encoder: any Encoder) throws {
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch (self) {
case let .dataCons0:
Expand Down
8 changes: 4 additions & 4 deletions .golden/swiftEnumSumOfProductWithNameCollisionSpec/golden
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
enum Enum: Codable {
public enum Enum: Codable {
case record0(Record0)
case record1(Record1)
case record2

enum CodingKeys: String, CodingKey {
public enum CodingKeys: String, CodingKey {
case tag
case contents
}

init(from decoder: any Decoder) throws {
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let discriminator = try container.decode(String.self, forKey: .tag)
switch discriminator {
Expand All @@ -26,7 +26,7 @@ enum Enum: Codable {
}
}

func encode(to encoder: any Encoder) throws {
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch (self) {
case let .record0(contents):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
enum Enum: Codable {
public enum Enum: Codable {
case dataCons0(Record0)
case dataCons1(Record1)
case dataCons2
case _unknown

enum CodingKeys: String, CodingKey {
public enum CodingKeys: String, CodingKey {
case tag
}

init(from decoder: any Decoder) throws {
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let discriminator = try container.decode(String.self, forKey: .tag)
switch discriminator {
Expand All @@ -23,7 +23,7 @@ enum Enum: Codable {
}
}

func encode(to encoder: any Encoder) throws {
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch (self) {
case let .dataCons0(value):
Expand Down
8 changes: 4 additions & 4 deletions .golden/swiftEnumSumOfProductWithTaggedObjectStyleSpec/golden
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
enum Enum: Codable {
public enum Enum: Codable {
case dataCons0(Record0)
case dataCons1(Record1)
case dataCons2

enum CodingKeys: String, CodingKey {
public enum CodingKeys: String, CodingKey {
case tag
case contents
}

init(from decoder: any Decoder) throws {
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let discriminator = try container.decode(String.self, forKey: .tag)
switch discriminator {
Expand All @@ -26,7 +26,7 @@ enum Enum: Codable {
}
}

func encode(to encoder: any Encoder) throws {
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch (self) {
case let .dataCons0(contents):
Expand Down
2 changes: 1 addition & 1 deletion .golden/swiftEnumValueClassDocSpec/golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Top-level enum documentation.
enum EnumAsValueClass: CaseIterable, Hashable, Codable {
public enum EnumAsValueClass: CaseIterable, Hashable, Codable {
/// ``First``
case first
/// ``Second``
Expand Down
2 changes: 1 addition & 1 deletion .golden/swiftEnumValueClassSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum EnumAsValueClass: CaseIterable, Hashable, Codable {
public enum EnumAsValueClass: CaseIterable, Hashable, Codable {
case first
case second
case third
Expand Down
2 changes: 1 addition & 1 deletion .golden/swiftGenericAliasSpec/golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
typealias TreeResponse = Tree
public typealias TreeResponse = Tree
6 changes: 3 additions & 3 deletions .golden/swiftGenericNewtypeSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct LTree<A: Hashable & Codable>: Hashable, Codable {
typealias LTreeTag = Tagged<LTree, [A]>
let value: LTreeTag
public struct LTree<A: Hashable & Codable>: Hashable, Codable {
public typealias LTreeTag = Tagged<LTree, [A]>
public let value: LTreeTag
}
6 changes: 3 additions & 3 deletions .golden/swiftGenericStructSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Tree<A: Hashable & Codable>: Hashable, Codable {
var rootLabel: A
var subForest: [Tree<A>]
public struct Tree<A: Hashable & Codable>: Hashable, Codable {
public var rootLabel: A
public var subForest: [Tree<A>]
}
6 changes: 3 additions & 3 deletions .golden/swiftMultipleTypeVariableSpec/golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Data<A: Hashable & Codable, B: Hashable & Codable>: CaseIterable, Hashable, Codable {
var field0: A
var field1: B
public struct Data<A: Hashable & Codable, B: Hashable & Codable>: CaseIterable, Hashable, Codable {
public var field0: A
public var field1: B
}
6 changes: 3 additions & 3 deletions .golden/swiftRecord0DuplicateRecordFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Record 0 with duplicate fields
struct Data0 {
var field0: Int
public struct Data0 {
public var field0: Int
/// not a duplicate
var field1: Int?
public var field1: Int?
}
6 changes: 3 additions & 3 deletions .golden/swiftRecord0SumOfProductDocSpec/golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Documentation for ``Record0``.
struct Record0: CaseIterable, Hashable, Codable {
public struct Record0: CaseIterable, Hashable, Codable {
/// The zeroth field of record 0
var record0Field0: Int
public var record0Field0: Int
/// The first field of record 0
var record0Field1: Int
public var record0Field1: Int
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Record0: Codable {
var record0Field0: Int
var record0Field1: Int
public struct Record0: Codable {
public var record0Field0: Int
public var record0Field1: Int
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Record0: Codable {
var record0Field0: Int
var record0Field1: Int
public struct Record0: Codable {
public var record0Field0: Int
public var record0Field1: Int
}
6 changes: 3 additions & 3 deletions .golden/swiftRecord1DuplicateRecordFieldSpec/golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Record 1 with duplicate fields
struct Data1 {
var field0: String
public struct Data1 {
public var field0: String
/// not a duplicate
var field2: String?
public var field2: String?
}
6 changes: 3 additions & 3 deletions .golden/swiftRecord1SumOfProductDocSpec/golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Documentation for ``Record1``.
struct Record1: CaseIterable, Hashable, Codable {
public struct Record1: CaseIterable, Hashable, Codable {
/// The zeroth field of record 1
var record1Field0: Int
public var record1Field0: Int
/// The first field of record 1
var record1Field1: Int
public var record1Field1: Int
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Record1: Codable {
var record1Field0: Int
var record1Field1: Int
public struct Record1: Codable {
public var record1Field0: Int
public var record1Field1: Int
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Record1: Codable {
var record1Field0: Int
var record1Field1: Int
public struct Record1: Codable {
public var record1Field0: Int
public var record1Field1: Int
}
2 changes: 1 addition & 1 deletion .golden/swiftStrictEnumsSpec-EnumA/golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
enum EnumA {
public enum EnumA {
case enumFirst
}
Loading
Loading