We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcode 10.2
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
md5: 266d9124f3754d31c23c6efca227f889
Issue Description:
typealias PartialKeyPathSet<Root> = Set<PartialKeyPath<Root>> protocol _Drivable: AnyObject {} extension _Drivable { typealias Driver = GenericDriver<Self> var driver: GenericDriver<Self> { get { return GenericDriver<Self>(driving: self) } set { /* no-op to allow mutation */ } } } struct GenericDriver<Drivable> { let __drivable: Drivable init(driving drivable: Drivable) { self.__drivable = drivable } } protocol Configurator { associatedtype Drivable: _Drivable typealias Driver = Drivable.Driver typealias DriverKeyPathSet = PartialKeyPathSet<Driver> func configure(_ driver: inout Driver, using set: DriverKeyPathSet) } struct AnyConfigurator<Drivable: _Drivable>: Configurator { private let _base: Any private let _function: (inout Driver, DriverKeyPathSet) -> Void init<Other>(_ other: Other) where Other: Configurator, Other.Drivable == Drivable { _base = other _function = other.configure(_:using:) } // error: Reference to invalid type alias 'Driver' of type 'AnyConfigurator<Drivable>' func configure(_ driver: inout Driver, using set: DriverKeyPathSet) { _function(&driver, set) } }
The type alias work for `_function` but it's mismatched for the implementation of the protocol requirement.
I assume this to compile the following relation `AnyConfigurator<Drivable>.Driver == Drivable.Driver == GenericDriver<Drivable>`.
Forums discussion: https://forums.swift.org/t/reference-to-invalid-type-alias-is-this-a-bug/22201
The text was updated successfully, but these errors were encountered:
[tweaked code to not require UIKit]
@slavapestov, any insights?
Sorry, something went wrong.
Comment by Garth Snyder (JIRA)
Simplified version:
protocol _Drivable: AnyObject { typealias Driver = Self } protocol Configurator { associatedtype Drivable: _Drivable typealias Driver = Drivable.Driver func configure(driver: Driver) } struct AnyConfigurator<Drivable: _Drivable>: Configurator { private let thing: Driver? // error: Reference to invalid type alias 'Driver' of type 'AnyConfigurator<Drivable>' func configure(driver: Driver) {} }
Comment by Zhu Shengqi (JIRA)
@slavapestov I have met a problem (warning not error), which may relate to this issue:
public protocol Observable { associatedtype Element associatedtype Failure: Error // warning: Neither type in same-type constraint ('Result<O.Element, O.Failure>' or 'Result<Self.Element, Self.Failure>') refers to a generic parameter or associated type func subscribe<O: Observable>(with observer: O) where O.ResultType == ResultType } extension Observable { public typealias ResultType = Result<Element, Failure> }
#28157
Not sure what happened, but its still reproducible on Xcode 14.3.1.
slavapestov
No branches or pull requests
Environment
Xcode 10.2
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Additional Detail from JIRA
md5: 266d9124f3754d31c23c6efca227f889
Issue Description:
The type alias work for `_function` but it's mismatched for the implementation of the protocol requirement.
I assume this to compile the following relation `AnyConfigurator<Drivable>.Driver == Drivable.Driver == GenericDriver<Drivable>`.
Forums discussion: https://forums.swift.org/t/reference-to-invalid-type-alias-is-this-a-bug/22201
The text was updated successfully, but these errors were encountered: