[SR-15263] Function cannot infer associated type #57585
Labels
associated type inference
compiler
The Swift compiler in itself
conformances
Feature → protocol: protocol conformances
feature
A feature request or implementation
Environment
Xcode 13.0 (13A233)
macOS Big Sur 11.6
Can provide more information if needed
Additional Detail from JIRA
md5: f079fc0caaa241678ef59a15f716b35a
Issue Description:
Error Description
Class that conforms to protocol with associated type and has as function with generic requirement doesn't compile, altough the compiler knows the exact type but doesn't use it to automatically infer the associated type.
The code to reproduce the error is:
Next code compiles as expected because type is explicit:
On the forums I discuss this topic and @groue verified it but with a different error note that I don't see in my Xcode 13 (different version maybe?). And just at the beginning there is a simplified implementation where I got the error and to reproduce it too.
Working code
This is some code to verify that the compiler infers the type in other similar cases:
The text was updated successfully, but these errors were encountered: