diff --git a/.golden/swiftAdvancedEnumSpec/golden b/.golden/swiftAdvancedEnumSpec/golden index 47c8d71..b0ffd25 100644 --- a/.golden/swiftAdvancedEnumSpec/golden +++ b/.golden/swiftAdvancedEnumSpec/golden @@ -1,4 +1,4 @@ -enum Enum: CaseIterable, Hashable, Codable { +public enum Enum: CaseIterable, Hashable, Codable { case a case b case c diff --git a/.golden/swiftAdvancedEnumWithRawValueSpec/golden b/.golden/swiftAdvancedEnumWithRawValueSpec/golden index 3d7e2fa..ed6e0c5 100644 --- a/.golden/swiftAdvancedEnumWithRawValueSpec/golden +++ b/.golden/swiftAdvancedEnumWithRawValueSpec/golden @@ -1,4 +1,4 @@ -enum Enum: String, CaseIterable, Hashable, Codable { +public enum Enum: String, CaseIterable, Hashable, Codable { case a case b } \ No newline at end of file diff --git a/.golden/swiftAdvancedNewtypeSpec/golden b/.golden/swiftAdvancedNewtypeSpec/golden index c7371f5..8f278c2 100644 --- a/.golden/swiftAdvancedNewtypeSpec/golden +++ b/.golden/swiftAdvancedNewtypeSpec/golden @@ -1,4 +1,4 @@ -struct Newtype: CaseIterable, Hashable, Codable { - typealias NewtypeTag = Tagged - let value: NewtypeTag +public struct Newtype: CaseIterable, Hashable, Codable { + public typealias NewtypeTag = Tagged + public let value: NewtypeTag } \ No newline at end of file diff --git a/.golden/swiftAdvancedNewtypeWithEnumFieldSpec/golden b/.golden/swiftAdvancedNewtypeWithEnumFieldSpec/golden index c9e4c3f..11728d7 100644 --- a/.golden/swiftAdvancedNewtypeWithEnumFieldSpec/golden +++ b/.golden/swiftAdvancedNewtypeWithEnumFieldSpec/golden @@ -1,3 +1,3 @@ -struct Newtype { - var newtypeField: Enum +public struct Newtype { + public var newtypeField: Enum } \ No newline at end of file diff --git a/.golden/swiftAdvancedRecordSpec/golden b/.golden/swiftAdvancedRecordSpec/golden index 000d349..2558421 100644 --- a/.golden/swiftAdvancedRecordSpec/golden +++ b/.golden/swiftAdvancedRecordSpec/golden @@ -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? } \ No newline at end of file diff --git a/.golden/swiftBasicDocSpec/golden b/.golden/swiftBasicDocSpec/golden index b089655..bbcaef6 100644 --- a/.golden/swiftBasicDocSpec/golden +++ b/.golden/swiftBasicDocSpec/golden @@ -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? } \ No newline at end of file diff --git a/.golden/swiftBasicEnumSpec/golden b/.golden/swiftBasicEnumSpec/golden index 9465edd..49a6f76 100644 --- a/.golden/swiftBasicEnumSpec/golden +++ b/.golden/swiftBasicEnumSpec/golden @@ -1,4 +1,4 @@ -enum Enum { +public enum Enum { case a case b case c diff --git a/.golden/swiftBasicEnumWithRawValueSpec/golden b/.golden/swiftBasicEnumWithRawValueSpec/golden index b15aa4b..bc19ce8 100644 --- a/.golden/swiftBasicEnumWithRawValueSpec/golden +++ b/.golden/swiftBasicEnumWithRawValueSpec/golden @@ -1,4 +1,4 @@ -enum Enum { +public enum Enum { case a case b } \ No newline at end of file diff --git a/.golden/swiftBasicNewtypeJoinOptionalsSpec/golden b/.golden/swiftBasicNewtypeJoinOptionalsSpec/golden index d34114e..60a4a11 100644 --- a/.golden/swiftBasicNewtypeJoinOptionalsSpec/golden +++ b/.golden/swiftBasicNewtypeJoinOptionalsSpec/golden @@ -1,4 +1,4 @@ -struct Newtype { - typealias NewtypeTag = Tagged - let value: NewtypeTag? +public struct Newtype { + public typealias NewtypeTag = Tagged + public let value: NewtypeTag? } \ No newline at end of file diff --git a/.golden/swiftBasicNewtypeSpec/golden b/.golden/swiftBasicNewtypeSpec/golden index d243492..23e467c 100644 --- a/.golden/swiftBasicNewtypeSpec/golden +++ b/.golden/swiftBasicNewtypeSpec/golden @@ -1,4 +1,4 @@ -struct Newtype { - typealias NewtypeTag = Tagged - let value: NewtypeTag +public struct Newtype { + public typealias NewtypeTag = Tagged + public let value: NewtypeTag } \ No newline at end of file diff --git a/.golden/swiftBasicNewtypeWithConcreteFieldSpec/golden b/.golden/swiftBasicNewtypeWithConcreteFieldSpec/golden index e7f0f04..7a4585c 100644 --- a/.golden/swiftBasicNewtypeWithConcreteFieldSpec/golden +++ b/.golden/swiftBasicNewtypeWithConcreteFieldSpec/golden @@ -1,3 +1,3 @@ -struct Newtype { - var newtypeField: String +public struct Newtype { + public var newtypeField: String } \ No newline at end of file diff --git a/.golden/swiftBasicNewtypeWithEitherFieldSpec/golden b/.golden/swiftBasicNewtypeWithEitherFieldSpec/golden index a4b0ab3..1f568d7 100644 --- a/.golden/swiftBasicNewtypeWithEitherFieldSpec/golden +++ b/.golden/swiftBasicNewtypeWithEitherFieldSpec/golden @@ -1,3 +1,3 @@ -struct Newtype { - var newtypeField: Result +public struct Newtype { + public var newtypeField: Result } \ No newline at end of file diff --git a/.golden/swiftBasicRecordSpec/golden b/.golden/swiftBasicRecordSpec/golden index b59f9c1..febacb3 100644 --- a/.golden/swiftBasicRecordSpec/golden +++ b/.golden/swiftBasicRecordSpec/golden @@ -1,4 +1,4 @@ -struct Data { - var field0: Int - var field1: Int? +public struct Data { + public var field0: Int + public var field1: Int? } \ No newline at end of file diff --git a/.golden/swiftDataSingleNullarySpec/golden b/.golden/swiftDataSingleNullarySpec/golden index 0b7982b..25672f0 100644 --- a/.golden/swiftDataSingleNullarySpec/golden +++ b/.golden/swiftDataSingleNullarySpec/golden @@ -1 +1 @@ -struct Data: Hashable, Codable {} \ No newline at end of file +public struct Data: Hashable, Codable {} \ No newline at end of file diff --git a/.golden/swiftDataSingleNullaryWithTypeVariableSpec/golden b/.golden/swiftDataSingleNullaryWithTypeVariableSpec/golden index a9b05b5..9957a72 100644 --- a/.golden/swiftDataSingleNullaryWithTypeVariableSpec/golden +++ b/.golden/swiftDataSingleNullaryWithTypeVariableSpec/golden @@ -1 +1 @@ -struct Data: Hashable, Codable {} \ No newline at end of file +public struct Data: Hashable, Codable {} \ No newline at end of file diff --git a/.golden/swiftDeprecatedFieldSpec/golden b/.golden/swiftDeprecatedFieldSpec/golden index 611fb54..69b4a03 100644 --- a/.golden/swiftDeprecatedFieldSpec/golden +++ b/.golden/swiftDeprecatedFieldSpec/golden @@ -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? } \ No newline at end of file diff --git a/.golden/swiftEnumSumOfProductDocSpec/golden b/.golden/swiftEnumSumOfProductDocSpec/golden index 6388a78..137233c 100644 --- a/.golden/swiftEnumSumOfProductDocSpec/golden +++ b/.golden/swiftEnumSumOfProductDocSpec/golden @@ -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 { @@ -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): diff --git a/.golden/swiftEnumSumOfProductSpec/golden b/.golden/swiftEnumSumOfProductSpec/golden index 9ea8879..4528634 100644 --- a/.golden/swiftEnumSumOfProductSpec/golden +++ b/.golden/swiftEnumSumOfProductSpec/golden @@ -1,8 +1,8 @@ -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 @@ -10,7 +10,7 @@ enum Enum: Hashable, Codable { 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 { @@ -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: diff --git a/.golden/swiftEnumSumOfProductWithNameCollisionSpec/golden b/.golden/swiftEnumSumOfProductWithNameCollisionSpec/golden index 175dbf7..ee61a53 100644 --- a/.golden/swiftEnumSumOfProductWithNameCollisionSpec/golden +++ b/.golden/swiftEnumSumOfProductWithNameCollisionSpec/golden @@ -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 { @@ -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): diff --git a/.golden/swiftEnumSumOfProductWithTaggedFlatObjectStyleSpec/golden b/.golden/swiftEnumSumOfProductWithTaggedFlatObjectStyleSpec/golden index 9d8c379..3969373 100644 --- a/.golden/swiftEnumSumOfProductWithTaggedFlatObjectStyleSpec/golden +++ b/.golden/swiftEnumSumOfProductWithTaggedFlatObjectStyleSpec/golden @@ -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 { @@ -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): diff --git a/.golden/swiftEnumSumOfProductWithTaggedObjectStyleSpec/golden b/.golden/swiftEnumSumOfProductWithTaggedObjectStyleSpec/golden index 033df7e..18a9f38 100644 --- a/.golden/swiftEnumSumOfProductWithTaggedObjectStyleSpec/golden +++ b/.golden/swiftEnumSumOfProductWithTaggedObjectStyleSpec/golden @@ -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 { @@ -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): diff --git a/.golden/swiftEnumValueClassDocSpec/golden b/.golden/swiftEnumValueClassDocSpec/golden index 0d0c8a9..478303c 100644 --- a/.golden/swiftEnumValueClassDocSpec/golden +++ b/.golden/swiftEnumValueClassDocSpec/golden @@ -1,5 +1,5 @@ /// Top-level enum documentation. -enum EnumAsValueClass: CaseIterable, Hashable, Codable { +public enum EnumAsValueClass: CaseIterable, Hashable, Codable { /// ``First`` case first /// ``Second`` diff --git a/.golden/swiftEnumValueClassSpec/golden b/.golden/swiftEnumValueClassSpec/golden index bb34a66..1ba0210 100644 --- a/.golden/swiftEnumValueClassSpec/golden +++ b/.golden/swiftEnumValueClassSpec/golden @@ -1,4 +1,4 @@ -enum EnumAsValueClass: CaseIterable, Hashable, Codable { +public enum EnumAsValueClass: CaseIterable, Hashable, Codable { case first case second case third diff --git a/.golden/swiftGenericAliasSpec/golden b/.golden/swiftGenericAliasSpec/golden index cfe3aa8..1bac1d5 100644 --- a/.golden/swiftGenericAliasSpec/golden +++ b/.golden/swiftGenericAliasSpec/golden @@ -1 +1 @@ -typealias TreeResponse = Tree \ No newline at end of file +public typealias TreeResponse = Tree \ No newline at end of file diff --git a/.golden/swiftGenericNewtypeSpec/golden b/.golden/swiftGenericNewtypeSpec/golden index f721340..372dfcd 100644 --- a/.golden/swiftGenericNewtypeSpec/golden +++ b/.golden/swiftGenericNewtypeSpec/golden @@ -1,4 +1,4 @@ -struct LTree: Hashable, Codable { - typealias LTreeTag = Tagged - let value: LTreeTag +public struct LTree: Hashable, Codable { + public typealias LTreeTag = Tagged + public let value: LTreeTag } \ No newline at end of file diff --git a/.golden/swiftGenericStructSpec/golden b/.golden/swiftGenericStructSpec/golden index 6a750e0..630b7a7 100644 --- a/.golden/swiftGenericStructSpec/golden +++ b/.golden/swiftGenericStructSpec/golden @@ -1,4 +1,4 @@ -struct Tree: Hashable, Codable { - var rootLabel: A - var subForest: [Tree] +public struct Tree: Hashable, Codable { + public var rootLabel: A + public var subForest: [Tree] } \ No newline at end of file diff --git a/.golden/swiftMultipleTypeVariableSpec/golden b/.golden/swiftMultipleTypeVariableSpec/golden index 56343fa..aa4ad65 100644 --- a/.golden/swiftMultipleTypeVariableSpec/golden +++ b/.golden/swiftMultipleTypeVariableSpec/golden @@ -1,4 +1,4 @@ -struct Data: CaseIterable, Hashable, Codable { - var field0: A - var field1: B +public struct Data: CaseIterable, Hashable, Codable { + public var field0: A + public var field1: B } \ No newline at end of file diff --git a/.golden/swiftRecord0DuplicateRecordFieldSpec/golden b/.golden/swiftRecord0DuplicateRecordFieldSpec/golden index ad76bb8..fec6641 100644 --- a/.golden/swiftRecord0DuplicateRecordFieldSpec/golden +++ b/.golden/swiftRecord0DuplicateRecordFieldSpec/golden @@ -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? } \ No newline at end of file diff --git a/.golden/swiftRecord0SumOfProductDocSpec/golden b/.golden/swiftRecord0SumOfProductDocSpec/golden index e7d248b..d926ebb 100644 --- a/.golden/swiftRecord0SumOfProductDocSpec/golden +++ b/.golden/swiftRecord0SumOfProductDocSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftRecord0SumOfProductWithTaggedFlatObjectStyleSpec/golden b/.golden/swiftRecord0SumOfProductWithTaggedFlatObjectStyleSpec/golden index 89c4fdd..0e7dd38 100644 --- a/.golden/swiftRecord0SumOfProductWithTaggedFlatObjectStyleSpec/golden +++ b/.golden/swiftRecord0SumOfProductWithTaggedFlatObjectStyleSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftRecord0SumOfProductWithTaggedObjectStyleSpec/golden b/.golden/swiftRecord0SumOfProductWithTaggedObjectStyleSpec/golden index 89c4fdd..0e7dd38 100644 --- a/.golden/swiftRecord0SumOfProductWithTaggedObjectStyleSpec/golden +++ b/.golden/swiftRecord0SumOfProductWithTaggedObjectStyleSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftRecord1DuplicateRecordFieldSpec/golden b/.golden/swiftRecord1DuplicateRecordFieldSpec/golden index 386049e..28b1fc5 100644 --- a/.golden/swiftRecord1DuplicateRecordFieldSpec/golden +++ b/.golden/swiftRecord1DuplicateRecordFieldSpec/golden @@ -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? } \ No newline at end of file diff --git a/.golden/swiftRecord1SumOfProductDocSpec/golden b/.golden/swiftRecord1SumOfProductDocSpec/golden index 4093876..f1c2221 100644 --- a/.golden/swiftRecord1SumOfProductDocSpec/golden +++ b/.golden/swiftRecord1SumOfProductDocSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftRecord1SumOfProductWithTaggedFlatObjectStyleSpec/golden b/.golden/swiftRecord1SumOfProductWithTaggedFlatObjectStyleSpec/golden index 17c6e15..dc4abe7 100644 --- a/.golden/swiftRecord1SumOfProductWithTaggedFlatObjectStyleSpec/golden +++ b/.golden/swiftRecord1SumOfProductWithTaggedFlatObjectStyleSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftRecord1SumOfProductWithTaggedObjectStyleSpec/golden b/.golden/swiftRecord1SumOfProductWithTaggedObjectStyleSpec/golden index 17c6e15..dc4abe7 100644 --- a/.golden/swiftRecord1SumOfProductWithTaggedObjectStyleSpec/golden +++ b/.golden/swiftRecord1SumOfProductWithTaggedObjectStyleSpec/golden @@ -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 } \ No newline at end of file diff --git a/.golden/swiftStrictEnumsSpec-EnumA/golden b/.golden/swiftStrictEnumsSpec-EnumA/golden index e28c12d..ea9a77b 100644 --- a/.golden/swiftStrictEnumsSpec-EnumA/golden +++ b/.golden/swiftStrictEnumsSpec-EnumA/golden @@ -1,3 +1,3 @@ -enum EnumA { +public enum EnumA { case enumFirst } \ No newline at end of file diff --git a/.golden/swiftStrictEnumsSpec-EnumB/golden b/.golden/swiftStrictEnumsSpec-EnumB/golden index 54917b2..2710bc5 100644 --- a/.golden/swiftStrictEnumsSpec-EnumB/golden +++ b/.golden/swiftStrictEnumsSpec-EnumB/golden @@ -1,3 +1,3 @@ -enum EnumB { +public enum EnumB { case fourth } \ No newline at end of file diff --git a/.golden/swiftStrictFieldsCheck-RecordA/golden b/.golden/swiftStrictFieldsCheck-RecordA/golden index e97c388..299d7d6 100644 --- a/.golden/swiftStrictFieldsCheck-RecordA/golden +++ b/.golden/swiftStrictFieldsCheck-RecordA/golden @@ -1,3 +1,3 @@ -struct RecordA { - var fieldA: String +public struct RecordA { + public var fieldA: String } \ No newline at end of file diff --git a/.golden/swiftStrictFieldsCheck-RecordB/golden b/.golden/swiftStrictFieldsCheck-RecordB/golden index 1ef5e43..2a9b80b 100644 --- a/.golden/swiftStrictFieldsCheck-RecordB/golden +++ b/.golden/swiftStrictFieldsCheck-RecordB/golden @@ -1,3 +1,3 @@ -struct RecordB { - var c: String +public struct RecordB { + public var c: String } \ No newline at end of file diff --git a/.golden/swiftSumOfProductWithTypeParameterSpec/golden b/.golden/swiftSumOfProductWithTypeParameterSpec/golden index 16cce7f..a203122 100644 --- a/.golden/swiftSumOfProductWithTypeParameterSpec/golden +++ b/.golden/swiftSumOfProductWithTypeParameterSpec/golden @@ -1,14 +1,14 @@ -enum CursorInput: CaseIterable, Hashable, Codable { +public enum CursorInput: CaseIterable, Hashable, Codable { case nextPage(A?) case previousPage(A) case unknown - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case direction case key } - 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: .direction) switch discriminator { @@ -26,7 +26,7 @@ enum CursorInput: 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 .nextPage(key): diff --git a/.golden/swiftTypeVariableSpec/golden b/.golden/swiftTypeVariableSpec/golden index 115a808..8037c2e 100644 --- a/.golden/swiftTypeVariableSpec/golden +++ b/.golden/swiftTypeVariableSpec/golden @@ -1,3 +1,3 @@ -struct Data: CaseIterable, Hashable, Codable { - var field0: A +public struct Data: CaseIterable, Hashable, Codable { + public var field0: A } \ No newline at end of file diff --git a/flake.lock b/flake.lock index a810dd6..d98d6b8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7db8b29..c289d45 100644 --- a/flake.nix +++ b/flake.nix @@ -22,18 +22,10 @@ pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system}); haskellPackages = eachSystem ( - system: let - pkgs = pkgsBySystem.${system}; - inherit (pkgs.haskell.lib) appendPatch; - in + system: eachHaskell ( haskell: - pkgs.haskell.packages.${haskell}.override (prev: { - overrides = _: hprev: { - # Wants bytestring <0.12 - cmark-gfm = appendPatch hprev.cmark-gfm ./nix/cmark-gfm-cabal.patch; - }; - }) + pkgsBySystem.${system}.haskell.packages.${haskell} ) ); in { diff --git a/nix/cmark-gfm-cabal.patch b/nix/cmark-gfm-cabal.patch deleted file mode 100644 index ad6e628..0000000 --- a/nix/cmark-gfm-cabal.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmark-gfm.cabal b/cmark-gfm.cabal -index 23277d8..4fc84b7 100644 ---- a/cmark-gfm.cabal -+++ b/cmark-gfm.cabal -@@ -69,7 +69,7 @@ library - exposed-modules: CMarkGFM - build-depends: base >=4.5 && < 5.0, - text >= 1.0 && < 2.1, -- bytestring >= 0.11.5 && < 0.12 -+ bytestring - if impl(ghc < 7.6) - build-depends: ghc-prim >= 0.2 - default-language: Haskell2010 diff --git a/src/Moat/Pretty/Kotlin.hs b/src/Moat/Pretty/Kotlin.hs index 392db8e..a4fc0e7 100644 --- a/src/Moat/Pretty/Kotlin.hs +++ b/src/Moat/Pretty/Kotlin.hs @@ -82,13 +82,13 @@ prettyStructFields indents fields deprecatedFields = go fields ++ ",\n" go [] = "" go (field@(Field fieldName _ _) : fs) = - case Map.lookup fieldName deprecatedFieldsMap of - Just mComment -> - maybe "" (\comment -> "// " ++ comment ++ "\n") mComment - ++ "//" - ++ prettyField field - ++ go fs - Nothing -> prettyField field ++ go fs + case Map.lookup fieldName deprecatedFieldsMap of + Just mComment -> + maybe "" (\comment -> "// " ++ comment ++ "\n") mComment + ++ "//" + ++ prettyField field + ++ go fs + Nothing -> prettyField field ++ go fs prettyEnumCases :: String -> [EnumCase] -> String prettyEnumCases indents = go diff --git a/src/Moat/Pretty/Swift.hs b/src/Moat/Pretty/Swift.hs index 9ec7038..f49325d 100644 --- a/src/Moat/Pretty/Swift.hs +++ b/src/Moat/Pretty/Swift.hs @@ -34,7 +34,7 @@ prettySwiftDataWith :: prettySwiftDataWith indent = \case MoatEnum {..} -> prettyTypeDoc "" enumDoc [] - ++ "enum " + ++ "public enum " ++ prettyMoatTypeHeader enumName (addTyVarBounds enumTyVars enumProtocols) ++ prettyRawValueAndProtocols enumRawValue enumProtocols ++ " {" @@ -48,7 +48,7 @@ prettySwiftDataWith indent = \case ++ "}" MoatStruct {..} -> prettyTypeDoc "" structDoc [] - ++ "struct " + ++ "public struct " ++ prettyMoatTypeHeader structName (addTyVarBounds structTyVars structProtocols) ++ prettyRawValueAndProtocols Nothing structProtocols ++ " {" @@ -61,27 +61,27 @@ prettySwiftDataWith indent = \case ++ "}" MoatAlias {..} -> prettyTypeDoc "" aliasDoc [] - ++ "typealias " + ++ "public typealias " -- Swift aliases should not declare type parameters ++ prettyMoatTypeHeader aliasName [] ++ " = " ++ prettyMoatTypeBase aliasTyp MoatNewtype {..} -> prettyTypeDoc "" newtypeDoc [] - ++ "struct " + ++ "public struct " ++ prettyMoatTypeHeader newtypeName (addTyVarBounds newtypeTyVars newtypeProtocols) ++ prettyRawValueAndProtocols Nothing newtypeProtocols ++ " {\n" ++ indents ++ if isConcrete newtypeField then - "let " + "public let " ++ fieldName newtypeField ++ ": " ++ prettyMoatType (fieldType newtypeField) ++ "\n}" else - "typealias " + "public typealias " ++ newtypeName ++ "Tag" ++ " = Tagged<" @@ -139,7 +139,7 @@ prettyTags indents = go "\n" ++ prettyTagDisambiguator tagDisambiguate indents tagName ++ indents - ++ "typealias " + ++ "public typealias " ++ tagName ++ " = Tagged<" ++ (if tagDisambiguate then tagName ++ "Tag" else tagParent) @@ -162,7 +162,7 @@ prettyTagDisambiguator disambiguate indents parent = if disambiguate then indents - ++ "enum " + ++ "public enum " ++ parent ++ "Tag { }\n" else "" @@ -266,8 +266,7 @@ prettyStructFields indents fields deprecatedFields = go fields where deprecatedFieldsMap = Map.fromList deprecatedFields prettyField (Field fieldName fieldType _fieldDoc) = - indents - ++ "var " + "public var " ++ fieldName ++ ": " ++ prettyMoatType fieldType @@ -276,19 +275,22 @@ prettyStructFields indents fields deprecatedFields = go fields go (field@(Field fieldName _ fieldDoc) : fs) = case Map.lookup fieldName deprecatedFieldsMap of Just mComment -> - maybe "" (\comment -> "// " ++ comment ++ "\n") mComment - ++ "//" + indents + ++ maybe "" (\comment -> "// " ++ comment ++ "\n") mComment + ++ indents + ++ "// " ++ prettyField field ++ go fs Nothing -> prettyTypeDoc indents fieldDoc [] + ++ indents ++ prettyField field ++ go fs prettyNewtypeField :: String -> Field -> String -> String prettyNewtypeField indents (Field alias fieldType _) fieldName = indents - ++ "let " + ++ "public let " ++ alias ++ ": " ++ fieldName @@ -326,7 +328,7 @@ prettyEnumCoding indents parentName cases unknownCase SumOfProductEncodingOption prettyCodingKeys :: String prettyCodingKeys = - "enum CodingKeys: String, CodingKey {" + "public enum CodingKeys: String, CodingKey {" ++ indent ( case encodingStyle of TaggedObjectStyle -> prettyTaggedCodingKeys @@ -352,7 +354,7 @@ prettyEnumCoding indents parentName cases unknownCase SumOfProductEncodingOption prettyInit :: String prettyInit = - "init(from decoder: any Decoder) throws {" + "public init(from decoder: any Decoder) throws {" ++ indent ( "let container = try decoder.container(keyedBy: CodingKeys.self)\n" ++ "let discriminator = try container.decode(String.self, forKey: ." @@ -474,7 +476,7 @@ prettyEnumCoding indents parentName cases unknownCase SumOfProductEncodingOption prettyEncode :: String prettyEncode = - "func encode(to encoder: any Encoder) throws {" + "public func encode(to encoder: any Encoder) throws {" ++ indent ( "var container = encoder.container(keyedBy: CodingKeys.self)\n" ++ "switch (self) {"