Skip to content

Swift 6.3 module selectors lead to false positives #6924

Open

Description

@defagos

New Issue Checklist

Bug Description

Module selectors introduced in Swift 6.3 lead to false positives with existing rules.

Consider for example the prefer_self_in_static_references rule. The following code does not trigger any violation:

enum TimeInterval {
    private static func defaultInterval() -> Foundation.TimeInterval {
        .init()
    }
}

but the following code:

enum TimeInterval {
    private static func defaultInterval() -> Foundation::TimeInterval {
        .init()
    }
}

does trigger

warning: Prefer Self in Static References Violation: Use `Self` to refer to the surrounding type name (prefer_self_in_static_references)

when running:

$ swiftlint lint

on the above source code.

The issue is here reported for the prefer_self_in_static_references rule but other rules might be affected as well.

Environment

  • SwiftLint 0.65.1.
  • Xcode 27.
  • Installed from source.
  • Configuration file:
opt_in_rules:
  - prefer_self_in_static_references

We are not using nested configurations.

Activity

  1. added
    bug
    on Sep 27, 2026
  2. added a commit that references this issue on Sep 29, 2026
    16ef0aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions