SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Add imports for typealias dependencies

Open keith opened this issue 2 years ago • 1 comments

Starting with Swift 5.8 there is a warning if you use a typealias that aliases a type from a module that you don't import. This handles that case by extracting the module name from the type alias' type.

Example:

// Module A
public struct Foo { ... }
// Module B
import A
public typealias Bar = Foo
// Module C
import B

func baz(arg: Bar) { ... }

In this example module C must now import A in order to avoid this warning.

keith avatar Feb 17 '23 22:02 keith

1 Warning
:warning: If this is a user-facing change, please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
18 Messages
:book: Linting Aerial with this PR took 1.07s vs 1.06s on main (0% slower)
:book: Linting Alamofire with this PR took 1.37s vs 1.37s on main (0% slower)
:book: Linting Brave with this PR took 7.33s vs 7.35s on main (0% faster)
:book: Linting DuckDuckGo with this PR took 3.04s vs 3.04s on main (0% slower)
:book: Linting Firefox with this PR took 9.18s vs 9.16s on main (0% slower)
:book: Linting Kickstarter with this PR took 9.86s vs 9.92s on main (0% faster)
:book: Linting Moya with this PR took 0.54s vs 0.55s on main (1% faster)
:book: Linting NetNewsWire with this PR took 3.03s vs 3.04s on main (0% faster)
:book: Linting Nimble with this PR took 0.6s vs 0.6s on main (0% slower)
:book: Linting PocketCasts with this PR took 7.35s vs 7.31s on main (0% slower)
:book: Linting Quick with this PR took 0.23s vs 0.23s on main (0% slower)
:book: Linting Realm with this PR took 11.66s vs 11.7s on main (0% faster)
:book: Linting SourceKitten with this PR took 0.43s vs 0.43s on main (0% slower)
:book: Linting Sourcery with this PR took 2.24s vs 2.23s on main (0% slower)
:book: Linting Swift with this PR took 4.53s vs 4.58s on main (1% faster)
:book: Linting VLC with this PR took 1.35s vs 1.35s on main (0% slower)
:book: Linting Wire with this PR took 8.79s vs 8.77s on main (0% slower)
:book: Linting WordPress with this PR took 11.0s vs 11.02s on main (0% faster)

Here's an example of your CHANGELOG entry:

* Add imports for typealias dependencies.  
  [keith](https://github.com/keith)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by :no_entry_sign: Danger

SwiftLintBot avatar Feb 17 '23 22:02 SwiftLintBot

dropping this for now because this warning went away after beta 1

keith avatar Apr 05 '23 18:04 keith