-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Description
This is probably a sorta niche use case, but I actually encountered an issue with this in one of my codebases.
A minimal reproduction:
protocol GenericProtocol {
associatedtype V
func genericParameter<T>(value: T)
}currently produces a DefaultImpl class that doesn't compile:
...
class DefaultImplCaller: GenericProtocol, @unchecked Sendable {
private let reference: Any
init<_CUCKOO$$GENERIC: GenericProtocol>(from defaultImpl: UnsafeMutablePointer<_CUCKOO$$GENERIC>, keeping reference: @escaping @autoclosure () -> Any?) where _CUCKOO$$GENERIC.V == V {
self.reference = reference
_storage$1$genericParameter = defaultImpl.pointee.genericParameter // error: Generic parameter 'T' could not be inferred
}
private let _storage$1$genericParameter: (T) -> Void // error: Cannot find type 'T' in scope
func genericParameter<T> (value p0: T) {
return _storage$1$genericParameter(p0)
}
}
...I had to fight with the compiler a bit, but I managed to figure out a fix. I'll be opening up a PR soon, but I just wanted to open up an issue to link to first.
Metadata
Metadata
Assignees
Labels
No labels