swift
swift copied to clipboard
[AST] Fix best import kind when value decl is a typealias of an existential type
Resolves #72724 .
Fixed behaviors:
/Users/lizhen/Projects/swift-projects/build/Ninja-DebugAssert/swift-macosx-arm64/bin/swift-frontend ./moduleB.swift -I . -L . -l./moduleA -typecheck
./moduleB.swift:3:17: error: type alias 'TypeAlias' (aka 'any Protocol') cannot be imported as 'protocol'
1 │
2 │ // Module B
3 │ import protocol ModuleA.TypeAlias
│ ╰─ error: type alias 'TypeAlias' (aka 'any Protocol') cannot be imported as 'protocol'
4 │ import typealias ModuleA.TypeAlias
/Users/lizhen/Projects/swift-debug/./ModuleA.swift:3:18: note: 'TypeAlias' declared here
1 │ // Module A
2 │ public protocol Protocol {}
3 │ public typealias TypeAlias = any Protocol
│ ╰─ note: 'TypeAlias' declared here
4 │