From 2cf1f90760b25aab9bc5ec9d9c2ef7ce7d4ef0fe Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Sun, 28 Jan 2024 14:20:19 +0330 Subject: [PATCH] rename `_undocumented` to `__undocumented` --- .../+EnumCaseElementSyntax.swift | 4 +- .../EnumCase/+Decodable.swift | 2 +- .../EnumCase/+init(rawValue).swift | 2 +- .../EnumCase/+var rawValue.swift | 2 +- Macros/UnstableEnumMacro/MacroError.swift | 2 +- Macros/UnstableEnumMacro/UnstableEnum.swift | 3 +- README.md | 2 +- Sources/DiscordGateway/DiscordCache.swift | 2 +- .../DiscordGateway/GatewayEventHandler.swift | 2 +- .../Types/Application Commands.swift | 6 +- ...Application Role Connection Metadata.swift | 2 +- Sources/DiscordModels/Types/Application.swift | 2 +- Sources/DiscordModels/Types/Audit Log.swift | 16 +-- .../DiscordModels/Types/Auto Moderation.swift | 6 +- Sources/DiscordModels/Types/Channel.swift | 30 +++--- Sources/DiscordModels/Types/Error Codes.swift | 2 +- Sources/DiscordModels/Types/Gateway.swift | 18 ++-- .../Types/Guild Scheduled Event.swift | 6 +- Sources/DiscordModels/Types/Guild.swift | 22 ++--- Sources/DiscordModels/Types/Integration.swift | 4 +- Sources/DiscordModels/Types/Interaction.swift | 24 ++--- Sources/DiscordModels/Types/Invite.swift | 2 +- Sources/DiscordModels/Types/OAuth2.swift | 2 +- Sources/DiscordModels/Types/Permission.swift | 4 +- Sources/DiscordModels/Types/SKU.swift | 4 +- Sources/DiscordModels/Types/Shared.swift | 4 +- .../DiscordModels/Types/Stage Instance.swift | 2 +- Sources/DiscordModels/Types/Sticker.swift | 4 +- Sources/DiscordModels/Types/Teams.swift | 4 +- Sources/DiscordModels/Types/User.swift | 8 +- Sources/DiscordModels/Types/Webhook.swift | 2 +- Sources/DiscordModels/UnstableEnumMacro.swift | 4 +- Tests/DiscordBMTests/DiscordModels.swift | 4 +- Tests/MacroTests/UnstableEnumMacro.swift | 98 +++++++++---------- 34 files changed, 150 insertions(+), 151 deletions(-) diff --git a/Macros/UnstableEnumMacro/+EnumCaseElementSyntax.swift b/Macros/UnstableEnumMacro/+EnumCaseElementSyntax.swift index a426c5d0..2961c6fc 100644 --- a/Macros/UnstableEnumMacro/+EnumCaseElementSyntax.swift +++ b/Macros/UnstableEnumMacro/+EnumCaseElementSyntax.swift @@ -10,10 +10,10 @@ extension [EnumCaseElementSyntax] { guard self.count > 0 else { return ([], false) } var `self` = self let last = self.removeLast() - guard last.name.trimmedDescription == "_undocumented" else { + guard last.name.trimmedDescription == "__undocumented" else { let diagnostic = Diagnostic( node: Syntax(last), - message: MacroError.lastCaseMustBe_undocumented + message: MacroError.lastCaseMustBe__undocumented ) context.diagnose(diagnostic) return ([], false) diff --git a/Macros/UnstableEnumMacro/EnumCase/+Decodable.swift b/Macros/UnstableEnumMacro/EnumCase/+Decodable.swift index ed8e31a9..d346c558 100644 --- a/Macros/UnstableEnumMacro/EnumCase/+Decodable.swift +++ b/Macros/UnstableEnumMacro/EnumCase/+Decodable.swift @@ -14,7 +14,7 @@ extension [EnumCase] { let rawValue = try container.decode(\#(raw: rawType.rawValue).self) self.init(rawValue: rawValue)! #if DISCORDBM_ENABLE_LOGGING_DURING_DECODE - if case let ._undocumented(rawValue) = self { + if case let .__undocumented(rawValue) = self { DiscordGlobalConfiguration.makeDecodeLogger("\#(raw: enumIdentifier.trimmedDescription)").warning( "Found an undocumented rawValue", metadata: [ diff --git a/Macros/UnstableEnumMacro/EnumCase/+init(rawValue).swift b/Macros/UnstableEnumMacro/EnumCase/+init(rawValue).swift index ef50a378..f1840df9 100644 --- a/Macros/UnstableEnumMacro/EnumCase/+init(rawValue).swift +++ b/Macros/UnstableEnumMacro/EnumCase/+init(rawValue).swift @@ -16,7 +16,7 @@ extension [EnumCase] { switch rawValue { \#(raw: cases.indented()) default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } """# diff --git a/Macros/UnstableEnumMacro/EnumCase/+var rawValue.swift b/Macros/UnstableEnumMacro/EnumCase/+var rawValue.swift index 4c06635d..7b416d68 100644 --- a/Macros/UnstableEnumMacro/EnumCase/+var rawValue.swift +++ b/Macros/UnstableEnumMacro/EnumCase/+var rawValue.swift @@ -15,7 +15,7 @@ extension [EnumCase] { \#(raw: accessLevel)var rawValue: \#(raw: rawType.rawValue) { switch self { \#(raw: cases.indented()) - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } diff --git a/Macros/UnstableEnumMacro/MacroError.swift b/Macros/UnstableEnumMacro/MacroError.swift index a1259273..a25f5080 100644 --- a/Macros/UnstableEnumMacro/MacroError.swift +++ b/Macros/UnstableEnumMacro/MacroError.swift @@ -14,7 +14,7 @@ enum MacroError: String, Error { case badEnumCaseTrailingTrivia case badEnumCaseComment case couldNotFindLocationOfNode - case lastCaseMustBe_undocumented + case lastCaseMustBe__undocumented } extension MacroError: DiagnosticMessage { diff --git a/Macros/UnstableEnumMacro/UnstableEnum.swift b/Macros/UnstableEnumMacro/UnstableEnum.swift index 59741fe1..bd327b1c 100644 --- a/Macros/UnstableEnumMacro/UnstableEnum.swift +++ b/Macros/UnstableEnumMacro/UnstableEnum.swift @@ -17,9 +17,9 @@ import SwiftSyntaxMacros /// case value12 // 12 /// ``` /// +/// Requires you to add a new `.__undocumented(RawValue)` case as the last case. /// How it manipulates the code: /// Adds `RawRepresentable` conformance where `RawValue` is the generic argument of the macro. -/// Adds a new `._undocumented(RawValue)` case. /// which can too easily result in code breakage. /// If `Decodable`, adds a slightly-modified `init(from:)` initializer. /// If `CaseIterable`, repairs the `static var allCases` requirement. @@ -57,7 +57,6 @@ public struct UnstableEnum: MemberMacro { if hasError { return [] } - /// Some validations let values = cases.map(\.value) diff --git a/README.md b/README.md index 4834163d..36da12be 100644 --- a/README.md +++ b/README.md @@ -715,7 +715,7 @@ Finally, add `import DiscordBM` to your source code. ## Versioning `DiscordBM` will try to follow Semantic Versioning 2.0.0, with exceptions: * To keep `DiscordBM` up to date with Discord API's frequent changes, `DiscordBM` will **add** any new properties to any types in **minor** versions, even if it's technically a breaking change. -* `DiscordBM` tries to minimize the effect of this requirement. For example most enums have an underscored case named `_undocumented` which asks users to use non-exhaustive switch statements, preventing future code-breakages. +* `DiscordBM` tries to minimize the effect of this requirement. For example most enums have an underscored case named `__undocumented` which asks users to use non-exhaustive switch statements, preventing future code-breakages. ## Contribution & Support * If you need help with anything, ask in [DiscordBM's Discord server](https://discord.gg/kxfs5n7HVE). diff --git a/Sources/DiscordGateway/DiscordCache.swift b/Sources/DiscordGateway/DiscordCache.swift index 8ee02e88..511faa5b 100644 --- a/Sources/DiscordGateway/DiscordCache.swift +++ b/Sources/DiscordGateway/DiscordCache.swift @@ -829,7 +829,7 @@ public actor DiscordCache { self.autoModerationExecutions[execution.guild_id, default: []].append(execution) case let .applicationCommandPermissionsUpdate(update): self.applicationCommandPermissions[update.id] = update - case ._undocumented: + case .__undocumented: break } } diff --git a/Sources/DiscordGateway/GatewayEventHandler.swift b/Sources/DiscordGateway/GatewayEventHandler.swift index 9075477e..e5531ae4 100644 --- a/Sources/DiscordGateway/GatewayEventHandler.swift +++ b/Sources/DiscordGateway/GatewayEventHandler.swift @@ -498,7 +498,7 @@ extension GatewayEventHandler { await withLogging(for: "onAutoModerationActionExecution") { try await onAutoModerationActionExecution(payload) } - case ._undocumented: + case .__undocumented: break } diff --git a/Sources/DiscordModels/Types/Application Commands.swift b/Sources/DiscordModels/Types/Application Commands.swift index 944ea31a..ae8c4f11 100644 --- a/Sources/DiscordModels/Types/Application Commands.swift +++ b/Sources/DiscordModels/Types/Application Commands.swift @@ -9,7 +9,7 @@ public struct ApplicationCommand: Sendable, Codable { case chatInput // 1 case user // 2 case message // 3 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure @@ -29,7 +29,7 @@ public struct ApplicationCommand: Sendable, Codable { case mentionable // 9 case number // 10 case attachment // 11 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure @@ -164,7 +164,7 @@ public struct GuildApplicationCommandPermissions: Sendable, Codable { case role // 1 case user // 2 case channel // 3 - case _undocumented(Int) + case __undocumented(Int) } public var type: Kind diff --git a/Sources/DiscordModels/Types/Application Role Connection Metadata.swift b/Sources/DiscordModels/Types/Application Role Connection Metadata.swift index 7b23a91f..28439789 100644 --- a/Sources/DiscordModels/Types/Application Role Connection Metadata.swift +++ b/Sources/DiscordModels/Types/Application Role Connection Metadata.swift @@ -13,7 +13,7 @@ public struct ApplicationRoleConnectionMetadata: Sendable, Codable, ValidatableP case dateTimeGreaterThanOrEqual // 6 case booleanEqual // 7 case booleanNotEqual // 8 - case _undocumented(Int) + case __undocumented(Int) } public var type: Kind diff --git a/Sources/DiscordModels/Types/Application.swift b/Sources/DiscordModels/Types/Application.swift index 2946ccd6..c5dab4fb 100644 --- a/Sources/DiscordModels/Types/Application.swift +++ b/Sources/DiscordModels/Types/Application.swift @@ -15,7 +15,7 @@ public struct DiscordApplication: Sendable, Codable { case gatewayMessageContent // 18 case gatewayMessageContentLimited // 19 case applicationCommandBadge // 23 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/resources/application#install-params-object diff --git a/Sources/DiscordModels/Types/Audit Log.swift b/Sources/DiscordModels/Types/Audit Log.swift index 40619914..428ce05a 100644 --- a/Sources/DiscordModels/Types/Audit Log.swift +++ b/Sources/DiscordModels/Types/Audit Log.swift @@ -183,7 +183,7 @@ public struct AuditLog: Sendable, Codable { case autoModerationUserCommunicationDisabled // 145 case creatorMonetizationRequestCreated // 150 case creatorMonetizationTermsAccepted // 151 - case _undocumented(Int) + case __undocumented(Int) } /// A mix of the below two types. @@ -246,7 +246,7 @@ public struct AuditLog: Sendable, Codable { case autoModerationUserCommunicationDisabled(AutoModerationInfo) case creatorMonetizationRequestCreated case creatorMonetizationTermsAccepted - case _undocumented + case __undocumented public struct OverwriteInfo: Sendable, Codable { @@ -515,8 +515,8 @@ public struct AuditLog: Sendable, Codable { self = .autoModerationUserCommunicationDisabled(moderationInfo) case .creatorMonetizationRequestCreated: self = .creatorMonetizationRequestCreated case .creatorMonetizationTermsAccepted: self = .creatorMonetizationTermsAccepted - case ._undocumented: - self = ._undocumented + case .__undocumented: + self = .__undocumented } } @@ -614,7 +614,7 @@ public struct AuditLog: Sendable, Codable { try container.encode(moderationInfo, forKey: .options) case .creatorMonetizationRequestCreated: break case .creatorMonetizationTermsAccepted: break - case ._undocumented: break + case .__undocumented: break } } } @@ -651,7 +651,7 @@ public struct AuditLog: Sendable, Codable { } public func encode(to encoder: any Encoder) throws { - if case ._undocumented = action { return } + if case .__undocumented = action { return } var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(self.guild_id, forKey: .guild_id) @@ -736,8 +736,8 @@ extension AuditLog.Entry.ActionKind { self = .creatorMonetizationTermsAccepted case .creatorMonetizationRequestCreated: self = .creatorMonetizationRequestCreated - case ._undocumented: - self = ._undocumented(-1) + case .__undocumented: + self = .__undocumented(-1) } } } diff --git a/Sources/DiscordModels/Types/Auto Moderation.swift b/Sources/DiscordModels/Types/Auto Moderation.swift index 678ecb56..93eb93d2 100644 --- a/Sources/DiscordModels/Types/Auto Moderation.swift +++ b/Sources/DiscordModels/Types/Auto Moderation.swift @@ -6,7 +6,7 @@ public struct AutoModerationRule: Sendable, Codable { @UnstableEnum public enum EventKind: Sendable, Codable { case messageSend // 1 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types @@ -16,7 +16,7 @@ public struct AutoModerationRule: Sendable, Codable { case spam // 3 case keywordPreset // 4 case mentionSpam // 5 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata @@ -28,7 +28,7 @@ public struct AutoModerationRule: Sendable, Codable { case profanity // 1 case sexualContent // 2 case slurs // 3 - case _undocumented(Int) + case __undocumented(Int) } public var keyword_filter: [String]? diff --git a/Sources/DiscordModels/Types/Channel.swift b/Sources/DiscordModels/Types/Channel.swift index 9704c087..8c0c7550 100644 --- a/Sources/DiscordModels/Types/Channel.swift +++ b/Sources/DiscordModels/Types/Channel.swift @@ -20,7 +20,7 @@ public struct DiscordChannel: Sendable, Codable { case guildStageVoice // 13 case guildDirectory // 14 case guildForum // 15 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/channel#overwrite-object @@ -31,7 +31,7 @@ public struct DiscordChannel: Sendable, Codable { public enum Kind: Sendable, Codable { case role // 0 case member // 1 - case _undocumented(Int) + case __undocumented(Int) } public var id: AnySnowflake @@ -45,7 +45,7 @@ public struct DiscordChannel: Sendable, Codable { public enum SortOrder: Sendable, Codable { case latestActivity // 0 case creationDate // 1 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/channel#channel-object-forum-layout-types @@ -54,7 +54,7 @@ public struct DiscordChannel: Sendable, Codable { case notSet // 0 case listView // 1 case galleryView // 2 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/channel#channel-object-channel-flags @@ -62,7 +62,7 @@ public struct DiscordChannel: Sendable, Codable { public enum Flag: Sendable { case pinned // 1 case requireTag // 4 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes @@ -70,7 +70,7 @@ public struct DiscordChannel: Sendable, Codable { public enum VideoQualityMode: Sendable, Codable { case auto // 1 case full // 2 - case _undocumented(Int) + case __undocumented(Int) } /// Not exactly documented, but they do mention these times in a few different places. @@ -82,7 +82,7 @@ public struct DiscordChannel: Sendable, Codable { case oneDay // 1_440 case threeDays // 4_320 case sevenDays // 10_080 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure @@ -208,7 +208,7 @@ extension DiscordChannel { case stageSpeaker // 29 case stageTopic // 31 case guildApplicationPremiumSubscription // 32 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/channel#message-object-message-flags @@ -225,7 +225,7 @@ extension DiscordChannel { case failedToMentionSomeRolesInThread // 8 case suppressNotifications // 12 case isVoiceMessage // 13 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/resources/channel#channel-mention-object @@ -243,7 +243,7 @@ extension DiscordChannel { @UnstableEnum public enum Flag: Sendable { case isRemix // 2 - case _undocumented(UInt) + case __undocumented(UInt) } public var id: AttachmentSnowflake @@ -349,7 +349,7 @@ extension DiscordChannel { case spectate // 2 case listen // 3 case joinRequest // 5 - case _undocumented(Int) + case __undocumented(Int) } public var type: Kind @@ -487,7 +487,7 @@ public enum ThreadKind: Sendable, Codable { case announcementThread // 10 case publicThread // 11 case privateThread // 12 - case _undocumented(Int) + case __undocumented(Int) } extension DiscordChannel { @@ -500,7 +500,7 @@ extension DiscordChannel { case roles case users case everyone - case _undocumented(String) + case __undocumented(String) } public var parse: [Kind] @@ -523,7 +523,7 @@ public struct Embed: Sendable, Codable, ValidatablePayload { case article // "article" case link // "link" case autoModerationMessage // "auto_moderation_message" - case _undocumented(String) + case __undocumented(String) } public enum DynamicURL: Sendable, Codable, ExpressibleByStringLiteral { @@ -708,7 +708,7 @@ extension DiscordChannel.Message.Kind { return true case .recipientAdd, .recipientRemove, .call, .channelNameChange, .channelIconChange, .guildDiscoveryDisqualified, .guildDiscoveryRequalified, .guildDiscoveryGracePeriodInitialWarning, .guildDiscoveryGracePeriodFinalWarning, .threadStarterMessage, .guildApplicationPremiumSubscription: return false - case ._undocumented: return false + case .__undocumented: return false } } } diff --git a/Sources/DiscordModels/Types/Error Codes.swift b/Sources/DiscordModels/Types/Error Codes.swift index fee9a835..187f9b3f 100644 --- a/Sources/DiscordModels/Types/Error Codes.swift +++ b/Sources/DiscordModels/Types/Error Codes.swift @@ -243,7 +243,7 @@ public enum JSONErrorCode: Sendable, Codable { case messageBlockedByHarmfulLinksFilter // 240000 case cannotEnableOnboardingRequirementsAreNotMet // 350000 case cannotUpdateOnboardingWhileBelowRequirements // 350001 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/topics/opcodes-and-status-codes#json diff --git a/Sources/DiscordModels/Types/Gateway.swift b/Sources/DiscordModels/Types/Gateway.swift index 529e3f95..b373b281 100644 --- a/Sources/DiscordModels/Types/Gateway.swift +++ b/Sources/DiscordModels/Types/Gateway.swift @@ -146,7 +146,7 @@ public struct Gateway: Sendable, Codable { case autoModerationActionExecution(AutoModerationActionExecution) - case _undocumented + case __undocumented public var correspondingIntents: [Intent] { switch self { @@ -186,7 +186,7 @@ public struct Gateway: Sendable, Codable { return [.autoModerationConfiguration] case .autoModerationActionExecution: return [.autoModerationExecution] - case ._undocumented: + case .__undocumented: return [] } } @@ -556,7 +556,7 @@ public struct Gateway: Sendable, Codable { case guildScheduledEvents // 16 case autoModerationConfiguration // 20 case autoModerationExecution // 21 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/topics/gateway-events#resume-resume-structure @@ -580,7 +580,7 @@ public struct Gateway: Sendable, Codable { case afk // "idle" case offline // "offline" case invisible // "invisible" - case _undocumented(String) + case __undocumented(String) } /// https://discord.com/developers/docs/topics/gateway-events#hello-hello-structure @@ -954,7 +954,7 @@ public struct Gateway: Sendable, Codable { public enum TargetKind: Sendable, Codable { case stream // 1 case embeddedApplication // 2 - case _undocumented(Int) + case __undocumented(Int) } public var channel_id: ChannelSnowflake @@ -1107,7 +1107,7 @@ public struct Gateway: Sendable, Codable { case normal // 0 /// FIXME: Discord calls this 'burst'. Can't change it to not break API case `super` // 1 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/topics/gateway-events#message-reaction-add-message-reaction-add-event-fields @@ -1206,7 +1206,7 @@ public struct Gateway: Sendable, Codable { case watching // 3 case custom // 4 case competing // 5 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-timestamps @@ -1284,7 +1284,7 @@ public struct Gateway: Sendable, Codable { case partyPrivacyFriends // 6 case partyPrivacyVoiceChannel // 7 case embedded // 8 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-buttons @@ -1441,7 +1441,7 @@ extension Gateway.Intent { case .autoModerationConfiguration: return false case .autoModerationExecution: return false /// Undocumented cases are considered privileged just to be safe than sorry - case ._undocumented: return true + case .__undocumented: return true } } } diff --git a/Sources/DiscordModels/Types/Guild Scheduled Event.swift b/Sources/DiscordModels/Types/Guild Scheduled Event.swift index badb1600..2f5ad07b 100644 --- a/Sources/DiscordModels/Types/Guild Scheduled Event.swift +++ b/Sources/DiscordModels/Types/Guild Scheduled Event.swift @@ -6,7 +6,7 @@ public struct GuildScheduledEvent: Sendable, Codable, ValidatablePayload { @UnstableEnum public enum PrivacyLevel: Sendable, Codable { case guildOnly // 2 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status @@ -16,7 +16,7 @@ public struct GuildScheduledEvent: Sendable, Codable, ValidatablePayload { case active // 2 case completed // 3 case canceled // 4 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types @@ -25,7 +25,7 @@ public struct GuildScheduledEvent: Sendable, Codable, ValidatablePayload { case stageInstance // 1 case voice // 2 case external // 3 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata diff --git a/Sources/DiscordModels/Types/Guild.swift b/Sources/DiscordModels/Types/Guild.swift index 8f04cbb6..a9c97fd3 100644 --- a/Sources/DiscordModels/Types/Guild.swift +++ b/Sources/DiscordModels/Types/Guild.swift @@ -11,7 +11,7 @@ public struct Guild: Sendable, Codable { case completedOnboarding // 1 case bypassVerification // 2 case startedOnboarding // 3 - case _undocumented(UInt) + case __undocumented(UInt) } public var user: DiscordUser? @@ -78,7 +78,7 @@ public struct Guild: Sendable, Codable { case medium // 2 case high // 3 case veryHigh // 4 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level @@ -86,7 +86,7 @@ public struct Guild: Sendable, Codable { public enum DefaultMessageNotificationLevel: Sendable, Codable { case allMessages // 0 case onlyMentions // 1 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level @@ -95,7 +95,7 @@ public struct Guild: Sendable, Codable { case disabled // 0 case memberWithoutRoles // 1 case allMembers // 2 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#guild-object-guild-features @@ -128,7 +128,7 @@ public struct Guild: Sendable, Codable { case verified // "VERIFIED" case vipRegions // "VIP_REGIONS" case welcomeScreenEnabled // "WELCOME_SCREEN_ENABLED" - case _undocumented(String) + case __undocumented(String) /// These ones are not mentioned in the Discord docs (There are even more of these). /// Might not even be valid anymore. @@ -154,7 +154,7 @@ public struct Guild: Sendable, Codable { public enum MFALevel: Sendable, Codable { case none // 0 case elevated // 1 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags @@ -166,7 +166,7 @@ public struct Guild: Sendable, Codable { case suppressJoinNotificationReplies // 3 case suppressRoleSubscriptionPurchaseNotifications // 4 case suppressRoleSubscriptionPurchaseNotificationReplies // 5 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/resources/guild#guild-object-premium-tier @@ -176,7 +176,7 @@ public struct Guild: Sendable, Codable { case tier1 // 1 case tier2 // 2 case tier3 // 3 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure @@ -208,7 +208,7 @@ public struct Guild: Sendable, Codable { case explicit // 1 case safe // 2 case ageRestricted // 3 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/guild#create-guild-json-params @@ -219,7 +219,7 @@ public struct Guild: Sendable, Codable { case fifteenMinutes // 900 case halfAnHour // 1800 case anHour // 3600 - case _undocumented(Int) + case __undocumented(Int) } public var id: GuildSnowflake @@ -374,7 +374,7 @@ extension Guild { public enum Kind: Sendable, Codable { case multipleChoice // 0 case dropdown // 1 - case _undocumented(Int) + case __undocumented(Int) } public var id: OnboardingPromptSnowflake diff --git a/Sources/DiscordModels/Types/Integration.swift b/Sources/DiscordModels/Types/Integration.swift index 041a5269..5038a468 100644 --- a/Sources/DiscordModels/Types/Integration.swift +++ b/Sources/DiscordModels/Types/Integration.swift @@ -9,7 +9,7 @@ public struct Integration: Sendable, Codable { case youtube case discord case guildSubscription // "guild_subscription" - case _undocumented(String) + case __undocumented(String) } /// https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors @@ -17,7 +17,7 @@ public struct Integration: Sendable, Codable { public enum ExpireBehavior: Sendable, Codable { case removeRole // 0 case kick // 1 - case _undocumented(Int) + case __undocumented(Int) } public var id: IntegrationSnowflake diff --git a/Sources/DiscordModels/Types/Interaction.swift b/Sources/DiscordModels/Types/Interaction.swift index 165916ba..aadf8d18 100644 --- a/Sources/DiscordModels/Types/Interaction.swift +++ b/Sources/DiscordModels/Types/Interaction.swift @@ -46,7 +46,7 @@ public struct Interaction: Sendable, Codable { case messageComponent // 3 case applicationCommandAutocomplete // 4 case modalSubmit // 5 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure @@ -360,7 +360,7 @@ public struct Interaction: Sendable, Codable { ) case .ping: self.data = nil - case ._undocumented: self.data = nil + case .__undocumented: self.data = nil } self.guild_id = try container.decodeIfPresent(GuildSnowflake.self, forKey: .guild_id) self.channel_id = try container.decodeIfPresent( @@ -459,7 +459,7 @@ extension Interaction { case roleSelect // 6 case mentionableSelect // 7 case channelSelect // 8 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/interactions/message-components#button-object-button-structure @@ -473,7 +473,7 @@ extension Interaction { case success // 3 case danger // 4 case link // 5 - case _undocumented(Int) + case __undocumented(Int) } /// The same as ``Style``, but has no `link`. @@ -505,7 +505,7 @@ extension Interaction { case .success: self = .success case .danger: self = .danger case .link: return nil - case ._undocumented: return nil + case .__undocumented: return nil } } } @@ -750,7 +750,7 @@ extension Interaction { public enum Style: Sendable, Codable { case short // 1 case paragraph // 2 - case _undocumented(Int) + case __undocumented(Int) } public var custom_id: String @@ -791,7 +791,7 @@ extension Interaction { case roleSelect(SelectMenu) case mentionableSelect(SelectMenu) case channelSelect(ChannelSelectMenu) - case _undocumented + case __undocumented public var customId: String? { switch self { @@ -809,7 +809,7 @@ extension Interaction { return value.custom_id case let .channelSelect(value): return value.custom_id - case ._undocumented: + case .__undocumented: return nil } } @@ -838,8 +838,8 @@ extension Interaction { self = try .channelSelect(.init(from: decoder)) case .textInput: self = try .textInput(.init(from: decoder)) - case ._undocumented: - self = ._undocumented + case .__undocumented: + self = .__undocumented } } @@ -867,7 +867,7 @@ extension Interaction { case let .channelSelect(selectMenu): try container.encode(Kind.channelSelect, forKey: .type) try selectMenu.encode(to: encoder) - case ._undocumented: break + case .__undocumented: break } } @@ -971,7 +971,7 @@ extension Interaction { selectMenu.validate() case .channelSelect(let channelSelectMenu): channelSelectMenu.validate() - case ._undocumented: + case .__undocumented: Optional.none } } diff --git a/Sources/DiscordModels/Types/Invite.swift b/Sources/DiscordModels/Types/Invite.swift index 7dd39ec2..6436e3c9 100644 --- a/Sources/DiscordModels/Types/Invite.swift +++ b/Sources/DiscordModels/Types/Invite.swift @@ -7,7 +7,7 @@ public struct Invite: Sendable, Codable { public enum TargetKind: Sendable, Codable { case stream // 1 case embeddedApplication // 2 - case _undocumented(Int) + case __undocumented(Int) } public var code: String diff --git a/Sources/DiscordModels/Types/OAuth2.swift b/Sources/DiscordModels/Types/OAuth2.swift index c02840a8..9430b826 100644 --- a/Sources/DiscordModels/Types/OAuth2.swift +++ b/Sources/DiscordModels/Types/OAuth2.swift @@ -29,5 +29,5 @@ public enum OAuth2Scope: Sendable, Codable { case rpcVoiceWrite // "rpc.voice.write" case voice // "voice" case webhookIncoming // "webhook.incoming" - case _undocumented(String) + case __undocumented(String) } diff --git a/Sources/DiscordModels/Types/Permission.swift b/Sources/DiscordModels/Types/Permission.swift index 414763a1..edaddcd4 100644 --- a/Sources/DiscordModels/Types/Permission.swift +++ b/Sources/DiscordModels/Types/Permission.swift @@ -49,7 +49,7 @@ public enum Permission: Sendable, Codable { case createEvents // 44 case useExternalSounds // 45 case sendVoiceMessages // 46 - case _undocumented(UInt) + case __undocumented(UInt) } /// https://discord.com/developers/docs/topics/permissions#role-object @@ -72,7 +72,7 @@ public struct Role: Sendable, Codable { @UnstableEnum public enum Flag: Sendable { case inPrompt // 0 - case _undocumented(UInt) + case __undocumented(UInt) } public var id: RoleSnowflake diff --git a/Sources/DiscordModels/Types/SKU.swift b/Sources/DiscordModels/Types/SKU.swift index 9df19a77..9a1f8021 100644 --- a/Sources/DiscordModels/Types/SKU.swift +++ b/Sources/DiscordModels/Types/SKU.swift @@ -7,7 +7,7 @@ public struct SKU: Sendable, Codable { public enum Kind: Sendable, Codable { case subscription // 5 case subscriptionGroup // 6 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/monetization/skus#sku-object-sku-flags @@ -16,7 +16,7 @@ public struct SKU: Sendable, Codable { case available // 2 case guildSubscription // 7 case userSubscription // 8 - case _undocumented(UInt) + case __undocumented(UInt) } public var id: SKUSnowflake diff --git a/Sources/DiscordModels/Types/Shared.swift b/Sources/DiscordModels/Types/Shared.swift index f23fe7bb..81f2d58d 100644 --- a/Sources/DiscordModels/Types/Shared.swift +++ b/Sources/DiscordModels/Types/Shared.swift @@ -196,7 +196,7 @@ public enum DiscordLocale: Sendable, Codable { case japanese // "ja" case chineseTaiwan // "zh-TW" case korean // "ko" - case _undocumented(String) + case __undocumented(String) } //MARK: - DiscordLocaleDict @@ -303,7 +303,7 @@ public struct DiscordLocaleDict: Codable, ExpressibleByDictionaryLit case .japanese: self.japanese = value case .chineseTaiwan: self.chineseTaiwan = value case .korean: self.korean = value - case ._undocumented: break /// Ignore + case .__undocumented: break /// Ignore } } } diff --git a/Sources/DiscordModels/Types/Stage Instance.swift b/Sources/DiscordModels/Types/Stage Instance.swift index 948b3eb3..fd4f22e1 100644 --- a/Sources/DiscordModels/Types/Stage Instance.swift +++ b/Sources/DiscordModels/Types/Stage Instance.swift @@ -7,7 +7,7 @@ public struct StageInstance: Sendable, Codable { public enum PrivacyLevel: Sendable, Codable { case `public` // 1 case guildOnly // 2 - case _undocumented(Int) + case __undocumented(Int) } public var id: StageInstanceSnowflake diff --git a/Sources/DiscordModels/Types/Sticker.swift b/Sources/DiscordModels/Types/Sticker.swift index 7c77d695..c8a45ac8 100644 --- a/Sources/DiscordModels/Types/Sticker.swift +++ b/Sources/DiscordModels/Types/Sticker.swift @@ -7,7 +7,7 @@ public struct Sticker: Sendable, Codable { public enum Kind: Sendable, Codable { case standard // 1 case guild // 2 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types @@ -17,7 +17,7 @@ public struct Sticker: Sendable, Codable { case apng // 2 case lottie // 3 case gif // 4 - case _undocumented(Int) + case __undocumented(Int) } public var id: StickerSnowflake diff --git a/Sources/DiscordModels/Types/Teams.swift b/Sources/DiscordModels/Types/Teams.swift index 4b754b64..83c62171 100644 --- a/Sources/DiscordModels/Types/Teams.swift +++ b/Sources/DiscordModels/Types/Teams.swift @@ -10,7 +10,7 @@ public struct Team: Sendable, Codable { public enum State: Sendable, Codable { case invited // 1 case accepted // 2 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/topics/teams#data-models-team-member-role-types @@ -19,7 +19,7 @@ public struct Team: Sendable, Codable { case admin // admin case developer // developer case readOnly // read_only - case _undocumented(String) + case __undocumented(String) } public var membership_state: State diff --git a/Sources/DiscordModels/Types/User.swift b/Sources/DiscordModels/Types/User.swift index d0696729..ce96a270 100644 --- a/Sources/DiscordModels/Types/User.swift +++ b/Sources/DiscordModels/Types/User.swift @@ -9,7 +9,7 @@ public struct DiscordUser: Sendable, Codable { case nitroClassic // 1 case nitro // 2 case nitroBasic // 3 - case _undocumented(Int) + case __undocumented(Int) } /// https://discord.com/developers/docs/resources/user#user-object-user-flags @@ -30,7 +30,7 @@ public struct DiscordUser: Sendable, Codable { case certifiedModerator // 18 case botHttpInteractions // 19 case activeDeveloper // 22 - case _undocumented(UInt) + case __undocumented(UInt) } public var id: UserSnowflake @@ -125,7 +125,7 @@ extension DiscordUser { case twitter // "Twitter" case xbox // "Xbox" case youtube // "YouTube" - case _undocumented(String) + case __undocumented(String) } /// https://discord.com/developers/docs/resources/user#connection-object-visibility-types @@ -133,7 +133,7 @@ extension DiscordUser { public enum VisibilityKind: Sendable, Codable { case none // 0 case everyone // 1 - case _undocumented(Int) + case __undocumented(Int) } public var id: String diff --git a/Sources/DiscordModels/Types/Webhook.swift b/Sources/DiscordModels/Types/Webhook.swift index c5a3bc6c..bcad50de 100644 --- a/Sources/DiscordModels/Types/Webhook.swift +++ b/Sources/DiscordModels/Types/Webhook.swift @@ -8,7 +8,7 @@ public struct Webhook: Sendable, Codable { case incoming // 1 case channelFollower // 2 case application // 3 - case _undocumented(Int) + case __undocumented(Int) } public var id: WebhookSnowflake diff --git a/Sources/DiscordModels/UnstableEnumMacro.swift b/Sources/DiscordModels/UnstableEnumMacro.swift index 417c8679..16b3032d 100644 --- a/Sources/DiscordModels/UnstableEnumMacro.swift +++ b/Sources/DiscordModels/UnstableEnumMacro.swift @@ -17,7 +17,7 @@ import UnstableEnumMacro /// /// How it manipulates the code: /// Adds `RawRepresentable` conformance where `RawValue` is the generic argument of the macro. -/// Adds a new `._undocumented(RawValue)` case. +/// Adds a new `.__undocumented(RawValue)` case. /// which can too easily result in code breakage. /// If `Decodable`, adds a slightly-modified `init(from:)` initializer. /// If `CaseIterable`, repairs the `static var allCases` requirement. @@ -25,7 +25,7 @@ import UnstableEnumMacro member, names: named(init), named(rawValue), - named(_undocumented), + named(__undocumented), named(allCases) ) @attached( diff --git a/Tests/DiscordBMTests/DiscordModels.swift b/Tests/DiscordBMTests/DiscordModels.swift index 979325c7..96dcbf42 100644 --- a/Tests/DiscordBMTests/DiscordModels.swift +++ b/Tests/DiscordBMTests/DiscordModels.swift @@ -276,7 +276,7 @@ class DiscordModelsTests: XCTestCase { let json = #"{"some":1}"# let data = Data(json.utf8) let value = try JSONDecoder().decode(CodableContainer.self, from: data) - XCTAssertEqual(value.some, ._undocumented(1)) + XCTAssertEqual(value.some, .__undocumented(1)) } do { @@ -602,7 +602,7 @@ private struct CodableContainer: Codable { enum UnstableEnumCodableTester: Codable { case a // 12 case h // 100 - case _undocumented(Int) + case __undocumented(Int) } var some: UnstableEnumCodableTester diff --git a/Tests/MacroTests/UnstableEnumMacro.swift b/Tests/MacroTests/UnstableEnumMacro.swift index eb380da8..58c076e5 100644 --- a/Tests/MacroTests/UnstableEnumMacro.swift +++ b/Tests/MacroTests/UnstableEnumMacro.swift @@ -16,7 +16,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a case b // bb - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -24,7 +24,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a case b // bb - case _undocumented(String) + case __undocumented(String) var rawValue: String { switch self { @@ -32,7 +32,7 @@ class UnstableEnumMacroTests: XCTestCase { return "a" case .b: return "bb" - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -44,7 +44,7 @@ class UnstableEnumMacroTests: XCTestCase { case "bb": self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } } @@ -61,7 +61,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum { case a case b // bb - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -69,7 +69,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum { case a case b // bb - case _undocumented(String) + case __undocumented(String) var rawValue: String { switch self { @@ -77,7 +77,7 @@ class UnstableEnumMacroTests: XCTestCase { return "a" case .b: return "bb" - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -89,7 +89,7 @@ class UnstableEnumMacroTests: XCTestCase { case "bb": self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } } @@ -106,7 +106,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // "oo" case b // "bb" - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -114,7 +114,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // "oo" case b // "bb" - case _undocumented(String) + case __undocumented(String) var rawValue: String { switch self { @@ -122,7 +122,7 @@ class UnstableEnumMacroTests: XCTestCase { return "oo" case .b: return "bb" - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -134,7 +134,7 @@ class UnstableEnumMacroTests: XCTestCase { case "bb": self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } } @@ -153,7 +153,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) } """, expandedSource: """ @@ -161,7 +161,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) var rawValue: Int { switch self { @@ -169,7 +169,7 @@ class UnstableEnumMacroTests: XCTestCase { return 1 case .b: return 5 - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -181,7 +181,7 @@ class UnstableEnumMacroTests: XCTestCase { case 5: self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } } @@ -200,7 +200,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable, Codable { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) } """, expandedSource: #""" @@ -208,7 +208,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable, Codable { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) var rawValue: Int { switch self { @@ -216,7 +216,7 @@ class UnstableEnumMacroTests: XCTestCase { return 1 case .b: return 5 - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -228,7 +228,7 @@ class UnstableEnumMacroTests: XCTestCase { case 5: self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } @@ -237,7 +237,7 @@ class UnstableEnumMacroTests: XCTestCase { let rawValue = try container.decode(Int.self) self.init(rawValue: rawValue)! #if DISCORDBM_ENABLE_LOGGING_DURING_DECODE - if case let ._undocumented(rawValue) = self { + if case let .__undocumented(rawValue) = self { DiscordGlobalConfiguration.makeDecodeLogger("MyEnum").warning( "Found an undocumented rawValue", metadata: [ @@ -263,7 +263,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable, Decodable, SomethingElse { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) } """, expandedSource: #""" @@ -271,7 +271,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable, Decodable, SomethingElse { case a // 1 case b // 5 - case _undocumented(Int) + case __undocumented(Int) var rawValue: Int { switch self { @@ -279,7 +279,7 @@ class UnstableEnumMacroTests: XCTestCase { return 1 case .b: return 5 - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -291,7 +291,7 @@ class UnstableEnumMacroTests: XCTestCase { case 5: self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } @@ -300,7 +300,7 @@ class UnstableEnumMacroTests: XCTestCase { let rawValue = try container.decode(Int.self) self.init(rawValue: rawValue)! #if DISCORDBM_ENABLE_LOGGING_DURING_DECODE - if case let ._undocumented(rawValue) = self { + if case let .__undocumented(rawValue) = self { DiscordGlobalConfiguration.makeDecodeLogger("MyEnum").warning( "Found an undocumented rawValue", metadata: [ @@ -328,7 +328,7 @@ class UnstableEnumMacroTests: XCTestCase { enum StringEnum: RawRepresentable, CaseIterable { case a case b - case _undocumented(String) + case __undocumented(String) } """, expandedSource: #""" @@ -336,7 +336,7 @@ class UnstableEnumMacroTests: XCTestCase { enum StringEnum: RawRepresentable, CaseIterable { case a case b - case _undocumented(String) + case __undocumented(String) var rawValue: String { switch self { @@ -344,7 +344,7 @@ class UnstableEnumMacroTests: XCTestCase { return "a" case .b: return "b" - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -356,7 +356,7 @@ class UnstableEnumMacroTests: XCTestCase { case "b": self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } @@ -382,7 +382,7 @@ class UnstableEnumMacroTests: XCTestCase { public enum MyEnum: RawRepresentable { case a case b // bb - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -390,7 +390,7 @@ class UnstableEnumMacroTests: XCTestCase { public enum MyEnum: RawRepresentable { case a case b // bb - case _undocumented(String) + case __undocumented(String) public var rawValue: String { switch self { @@ -398,7 +398,7 @@ class UnstableEnumMacroTests: XCTestCase { return "a" case .b: return "bb" - case let ._undocumented(rawValue): + case let .__undocumented(rawValue): return rawValue } } @@ -410,7 +410,7 @@ class UnstableEnumMacroTests: XCTestCase { case "bb": self = .b default: - self = ._undocumented(rawValue) + self = .__undocumented(rawValue) } } } @@ -429,7 +429,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b - case _undocumented(Int) + case __undocumented(Int) } """, expandedSource: """ @@ -437,7 +437,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b - case _undocumented(Int) + case __undocumented(Int) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -459,7 +459,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // bb case b // 1 - case _undocumented(Int) + case __undocumented(Int) } """, expandedSource: """ @@ -467,7 +467,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // bb case b // 1 - case _undocumented(Int) + case __undocumented(Int) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -487,7 +487,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 2 case b // 1 - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -495,7 +495,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 2 case b // 1 - case _undocumented(String) + case __undocumented(String) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -517,7 +517,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // a case b // "1 - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -525,7 +525,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // a case b // "1 - case _undocumented(String) + case __undocumented(String) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -547,7 +547,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b // 1 - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -555,7 +555,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a // 1 case b // 1 - case _undocumented(String) + case __undocumented(String) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -577,7 +577,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a = "g" case b = "gg" - case _undocumented(String) + case __undocumented(String) } """, expandedSource: """ @@ -585,7 +585,7 @@ class UnstableEnumMacroTests: XCTestCase { enum MyEnum: RawRepresentable { case a = "g" case b = "gg" - case _undocumented(String) + case __undocumented(String) } extension MyEnum: RawRepresentable, LosslessRawRepresentable, Hashable { @@ -630,7 +630,7 @@ class UnstableEnumMacroTests: XCTestCase { """, diagnostics: [ .init( - message: "lastCaseMustBe_undocumented", + message: "lastCaseMustBe__undocumented", line: 4, column: 10 ) @@ -641,7 +641,7 @@ class UnstableEnumMacroTests: XCTestCase { func testEnumCodableWorks() async throws { let b = MyEnum.b - let u = MyEnum._undocumented(5) + let u = MyEnum.__undocumented(5) let b2 = try JSONEncoder().encode(b) let u2 = try JSONEncoder().encode(u) @@ -659,5 +659,5 @@ enum MyEnum: Sendable, Codable { case a // 1 case b // 7 case c // 9 - case _undocumented(Int) + case __undocumented(Int) }