realm / realm/SwiftLint

UnusedImportRule + `==` broken with Xcode 11.5

Open
#3,256 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When using the UnusedImportRule to identify unused imports when only an operator from a module is used, it appears SourceKit no longer returns the module defining the Equatable operator override and instead returns that it comes from Swift.

In our example we have:

public func == (lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool {
...
}

And then a file uses this directly. It appears that SwiftLint still does the expected cursorinfo request on the == at the callsite, but it now returns Swift instead of our custom module. This is probably something we should report upstream with a good repro case, but I wanted to file here too as a marker.

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 with UnusedImportRule and its SourceKit cursorinfo request, then reproduce the operator example using Xcode 11.5. Compare the reported module for the == callsite and determine whether a minimal reproduction can be prepared for an upstream report; done when the behavior is reproduced and the appropriate fix or report path is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.