Skip to content

Don't rewrite is/as cast operands to Self in prefer_self_in_static_references - #6765

Merged
SimplyDanny merged 2 commits into
realm:mainfrom
Brett-Best:fix/prefer-self-is-as-dynamic-self
Jun 8, 2026
Merged

Don't rewrite is/as cast operands to Self in prefer_self_in_static_references#6765
SimplyDanny merged 2 commits into
realm:mainfrom
Brett-Best:fix/prefer-self-is-as-dynamic-self

Conversation

@Brett-Best

Copy link
Copy Markdown
Contributor

Summary

prefer_self_in_static_references rewrote the type operand of an is / as? / as! cast to Self inside class-like scopes. Because Self is the dynamic type, this silently changes runtime behavior for non-final classes (the code still compiles):

class A {}
class B: A {}

extension A {
    func isA(_ x: Any) -> Bool { x is A }   // autocorrected to `x is Self`
}

B().isA(A())   // before fix (`x is A`):   true
               // after  fix (`x is Self`): false   // Self == B, and an A() is not a B

This is more dangerous than the existing composition/existential cases (which produced uncompilable code that fails fast) — this compiles and quietly breaks logic. The rule already guards the analogous X.self case in class-like scopes for exactly this dynamic-vs-static reason; is/as was an inconsistent gap.

Fix

Skip the type operand of is / as / as? / as! casts in class-like scopes, via visit(TypeExprSyntax) (detecting the operand as the element following an unresolved is/as operator in the sequence expression). This mirrors the existing X.self skip.

Unaffected (still corrected, as before):

  • static member references — A.f()Self.f()
  • value-type scopes — in a struct/enum, Self == the type, so x is Sx is Self is safe and stays corrected
  • [A]() and other non-cast type-as-value expressions

Tests

  • New non-triggering example for the reported bug (x is A, x as? A in a class extension).
  • The is A.Type example added in Don't rewrite composition/existential types to Self in prefer_self_in_static_references #6749 and the pre-existing class T { … (input as! T).child … } example both become non-triggering (their cast operands are now left alone), reflecting the corrected behavior.
  • Verified at runtime that B().isA(A()) stays true after --fix, and that swiftlint lint --strict and the rule's generated tests pass.

Fixes #6764

🤖 Generated with Claude Code

`prefer_self_in_static_references` rewrote the type operand of an
`is` / `as?` / `as!` cast to `Self` inside class-like scopes. Because `Self`
is the dynamic type, this silently changed runtime behavior for non-final
classes: `x is A` (true for an `A` instance regardless of the caller) became
`x is Self`, which is false when the method is invoked on a subclass instance.
The rule already guards the analogous `X.self` case; `is`/`as` was an
inconsistent gap.

Skip the type operand of is/as casts in class-like scopes via
`visit(TypeExprSyntax)`. Static member references (`A.f()`) and value-type
scopes (`struct`/`enum`, where `Self` == the type) are unaffected.

Two examples that pinned the old behavior become non-triggering: the
`is A.Type` example from realm#6749 (the metatype is an is-operand, now left alone)
and the pre-existing `class T { ... (input as! T).child ... }` example (its
only violation was the `as! T` rewrite).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes prefer_self_in_static_references to avoid rewriting cast type operands (e.g. x is A, x as? A) to Self in class-like scopes where that rewrite can change runtime semantics for non-final types.

Changes:

  • Skip visiting TypeExprSyntax when it’s the operand of is/as casts in class-like scopes to prevent incorrect rewrites.
  • Add helper logic to detect cast operands in sequence expressions.
  • Update rule examples and changelog to reflect the corrected behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
Source/SwiftLintBuiltInRules/Rules/Style/PreferSelfInStaticReferencesRuleExamples.swift Moves cast-operand cases into non-triggering examples and removes corresponding corrections.
Source/SwiftLintBuiltInRules/Rules/Style/PreferSelfInStaticReferencesRule.swift Adds cast-operand detection and skips rewriting type operands in class-like scopes.
CHANGELOG.md Documents the bug fix and links the issue/author.

Comment thread Source/SwiftLintBuiltInRules/Rules/Style/PreferSelfInStaticReferencesRule.swift Outdated
Comment thread CHANGELOG.md
- `isCastOperand` now does an O(1) parent check: `ExprListSyntax` is used
  solely for a sequence expression's elements, where a bare type expression
  only appears as an `is`/`as` operand, so no scan is needed.
- Mention plain `as` in the visitor comment (it is handled too).
- Drop the unreferenced `class B: A {}` from the non-triggering example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SwiftLintBot

SwiftLintBot commented Jun 8, 2026

Copy link
Copy Markdown
1 Warning
⚠️ This PR may need tests.
380 Messages
📖 Building this branch resulted in a binary size of 27537.37 KiB vs 27537.02 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.64 s vs 0.65 s on main (1% faster).
📖 Linting Alamofire with this PR took 0.93 s vs 0.99 s on main (6% faster).
📖 Linting Brave with this PR took 6.08 s vs 6.08 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 25.17 s vs 25.13 s on main (0% slower).
📖 Linting Firefox with this PR took 10.37 s vs 10.4 s on main (0% faster).
📖 Linting Kickstarter with this PR took 7.56 s vs 7.5 s on main (0% slower).
📖 Linting Moya with this PR took 0.38 s vs 0.37 s on main (2% slower).
📖 Linting NetNewsWire with this PR took 2.32 s vs 2.33 s on main (0% faster).
📖 Linting Nimble with this PR took 0.57 s vs 0.56 s on main (1% slower).
📖 Linting PocketCasts with this PR took 7.19 s vs 7.12 s on main (0% slower).
📖 Linting Quick with this PR took 0.35 s vs 0.35 s on main (0% slower).
📖 Linting Realm with this PR took 2.45 s vs 2.48 s on main (1% faster).
📖 Linting Sourcery with this PR took 1.53 s vs 1.51 s on main (1% slower).
📖 Linting Swift with this PR took 4.24 s vs 4.25 s on main (0% faster).
📖 Linting SwiftLintPerformanceTests with this PR took 0.17 s vs 0.16 s on main (6% slower).
📖 Linting VLC with this PR took 1.05 s vs 1.03 s on main (1% slower).
📖 Linting Wire with this PR took 15.18 s vs 15.21 s on main (0% faster).
📖 Linting WordPress with this PR took 10.55 s vs 10.57 s on main (0% faster).
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:27:35: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:28:32: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:29:32: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:30:30: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:31:29: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:35:35: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:36:32: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:37:32: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:38:30: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:39:29: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/BraveWallet/Extensions/BraveWalletExtensions.swift:145:35: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/BraveWallet/Extensions/BraveWalletExtensions.swift:156:35: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/ScriptHandlers/Paged/PlaylistScriptHandler.swift:265:11: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/Favorites/Views/SupplementaryViews/FavoritesSectionBackgroundView.swift:15:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/Favorites/Views/SupplementaryViews/FavoritesSectionBackgroundView.swift:22:34: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/Search/Views/SupplementaryViews/SearchSectionBackground.swift:15:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/Search/Views/SupplementaryViews/SearchSectionBackground.swift:22:34: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/FilterListSetting.swift:74:57: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/CustomFilterListSetting.swift:49:57: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/PlaylistFolder.swift:206:75: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/RecentSearches.swift:45:63: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/RecentSearches.swift:51:63: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/RecentSearches.swift:100:59: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/PlaylistItem.swift:579:51: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/Favorite.swift:111:59: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/Favorite.swift:294:76: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Brave: /ios/brave-ios/Sources/Data/models/Domain.swift:414:85: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/LocalPackages/SyncUI-iOS/Sources/SyncUI-iOS/ViewModels/SyncSettingsViewModel.swift:219:38: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/Core/Link.swift:75:37: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/Core/BookmarkObjects.swift:64:64: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/FileSizeDebugViewController.swift:136:107: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/FileSizeDebugViewController.swift:252:117: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/SyncSettingsViewController.swift:254:68: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/SyncSettingsViewController.swift:354:44: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/FeedbackFormViewController.swift:66:105: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/DataImport/DataImportViewController.swift:161:65: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/Subscription/Feedback/VPNMetadataCollector.swift:268:56: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/FeedbackPickerViewController.swift:35:107: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/NotificationView.swift:76:122: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/Tab.swift:245:37: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /iOS/DuckDuckGo/AuthenticationViewController.swift:41:82: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Tests/NavigationTests/Helpers/WKNavigationActionMock.swift:125:91: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Tests/NavigationTests/Helpers/WKWebView+KillWebContentProcess.swift:26:48: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SyncDataProviders/Settings/SettingsSyncHandlers/EmailManager+SyncSupporting.swift:30:66: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:109:35: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:109:66: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:111:27: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:111:50: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:176:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/Model/AnyDecodable.swift:178:28: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/Navigation/Extensions/WKErrorExtension.swift:42:61: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SecureStorage/SecureStorageError.swift:100:49: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/Bookmarks/BookmarkEntity.swift:136:47: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/Bookmarks/BookmarkEntity.swift:152:45: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/Bookmarks/BookmarkEntity.swift:157:46: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SpecialErrorPages/SSLErrorType.swift:77:74: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SpecialErrorPages/SSLErrorType.swift:95:42: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SpecialErrorPages/SSLErrorType.swift:107:60: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKitTestsUtils/WebKit/MockWKSecurityOrigin.swift:51:91: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKitTestsUtils/WebKit/MockWKSecurityOrigin.swift:61:91: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/UnitTests/Permissions/WebViewMock.swift:181:91: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/UnitTests/Geolocation/CLLocationManagerMock.swift:29:71: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/UnitTests/Geolocation/CLLocationManagerMock.swift:37:71: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/LocalPackages/AppKitExtensions/Sources/AppKitExtensions/NSImageExtension.swift:155:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Sharing/SharingMenu.swift:201:103: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/TabBar/View/TabBarViewItem.swift:1620:125: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Tab/View/WebView.swift:385:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Tab/View/WebView.swift:402:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/BookmarksBar/View/BookmarksBarMenuCustomPopover.swift:238:57: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/BookmarksBar/View/BookmarksBarMenuCustomPopover.swift:265:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/AIChat/Sidebar/AIChatCoordinator.swift:809:80: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Common/View/AppKit/HoverTrackingArea.swift:27:70: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/FindInPage/FindInPageViewController.swift:52:91: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Bookmarks/Model/BookmarkManagedObject.swift:112:38: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Bookmarks/Model/Bookmark.swift:139:45: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Bookmarks/Model/Bookmark.swift:145:57: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Bookmarks/Model/Bookmark.swift:155:41: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in DuckDuckGo: /macOS/DuckDuckGo/Bookmarks/Model/Bookmark.swift:245:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Firefox: /firefox-ios/Client/Extensions/String+Extension.swift:73:88: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Firefox: /firefox-ios/Client/Application/SceneDelegate.swift:72:58: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Firefox: /focus-ios/Widgets/Widgets.swift:67:86: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Kickstarter: /Kickstarter-Framework/Sources/Kickstarter-Framework/Kickstarter-iOS/Features/PaymentMethods/Controller/PaymentMethodSettingsViewController.swift:180:34: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in NetNewsWire: /Shared/Extensions/NSAttributedString+Extensions.swift:57:29: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in NetNewsWire: /Shared/Extensions/NSAttributedString+Extensions.swift:237:28: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in NetNewsWire: /Modules/RSCore/Sources/RSCore/AppKit/NSImage+RSCore.swift:15:31: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in NetNewsWire: /Modules/Account/Sources/Account/UnreadCountProvider.swift:35:49: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in NetNewsWire: /Modules/Account/Sources/Account/Account.swift:1164:31: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Nimble: /Tests/NimbleTests/Matchers/EqualTest.swift:194:44: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Nimble: /Sources/Nimble/Adapters/NimbleEnvironment.swift:16:34: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Nimble: /Sources/Nimble/Matchers/Matcher.swift:285:45: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Nimble: /Sources/Nimble/Matchers/MatcherProtocols.swift:97:40: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/NoSearchResultsPlaceholder.swift:13:22: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/EpisodeLimitPlaceholder.swift:23:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/AllArchivedPlaceholder.swift:23:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/ListPodcast.swift:25:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/ListPlaylist.swift:32:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/ListHeader.swift:24:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/HomeGridListItem.swift:49:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Lists/ListEpisode.swift:25:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/OptionsPickerRootController.swift:284:52: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/TimeSliderLayer.swift:32:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/New Detail/Playlist Header/PlaylistHeaderViewCellPlaceholder.swift:11:22: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/New Detail/Playlist Archive/PlaylistArchiveViewCellPlaceholder.swift:20:39: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /podcasts/Common Components/Progress Views/ProgressLineLayer.swift:37:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Sorting/PodcastSorter.swift:85:37: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /Modules/Sources/PocketCastsDataModel/Public/Model/Podcast.swift:128:45: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /Modules/Sources/PocketCastsDataModel/Public/Model/Episode.swift:192:45: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in PocketCasts: /Modules/Sources/PocketCastsDataModel/Public/Model/EpisodeFilter.swift:100:44: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Realm: /RealmSwift/Impl/ObjcBridgeable.swift:61:69: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Realm: /RealmSwift/Impl/ObjcBridgeable.swift:136:34: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Realm: /RealmSwift/Impl/BasicTypes.swift:255:58: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Realm: /RealmSwift/Impl/BasicTypes.swift:278:60: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/EnumCase.swift:65:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/EnumCase.swift:93:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/GenericRequirement.swift:51:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/GenericRequirement.swift:75:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/GenericParameter.swift:31:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/GenericParameter.swift:51:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/AssociatedValue.swift:61:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/AssociatedValue.swift:87:36: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
📖 This PR fixed a violation in Sourcery: /SourceryRuntime/Sources/macOS/AST/MethodParameter.swift:103:43: Warning: Use Self to refer to the surrounding type name (prefer_self_in_static_references)
⚠️ Danger found 380 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 140.

Generated by 🚫 Danger

@SimplyDanny SimplyDanny left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @Brett-Best!

@SimplyDanny
SimplyDanny merged commit 16f6aed into realm:main Jun 8, 2026
26 checks passed
@Brett-Best
Brett-Best deleted the fix/prefer-self-is-as-dynamic-self branch June 8, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prefer_self_in_static_references rewrites is/as type operands to Self, silently changing runtime behavior

4 participants