realm / realm/SwiftLint

`unused_parameter` spurious violation for parameters used in calls to raw identifier functions whose name is a keyword, when prefixed with Swift 6.3 module selector

Open
#6,816 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug swift-compiler
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Bug Description

unused_parameter reports a spurious violation for parameters used in calls to a function whose name is the same as a keyword (achieved via raw identifiers) when, and only when, prefixed with a Swift 6.3 module selector:

Note: since module selectors are relatively new, there might be other bugs involving them.

func `as`(_: Int) {}
func `is`(_: Int) {}
func `a`(_: Int) {}

func violation(_ x: Int) { // violation: Parameter 'x' is unused
	Module::as(x)
	Module::is(x)
}

func noViolation1(_ x: Int) {
	Module::a(x)
}

func noViolation2(_ x: Int) {
	`as`(x)
}

func noViolation3(_ x: Int) {
	`is`(x)
}

func noViolation4(_ x: Int) {
	Module.as(x)
}

func noViolation5(_ x: Int) {
	Module.is(x)
}
$ swiftlint lint --only-rule unused_parameter Sources
Environment
  • SwiftLint version: 0.65.0
  • Xcode version: Xcode 26.6 / Build version 17F113
  • Installation method used: Homebrew
  • Configuration file: occurs without a config file

Are you using nested configurations?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example with swiftlint lint --only-rule unused_parameter Sources, then trace the unused_parameter rule's handling of calls using raw identifiers and Swift 6.3 module selectors. Done means parameters passed to Module::as(x) and Module::is(x) no longer produce false violations while the other examples retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.