Recent improvements to associated type inference

Here is a small example:

echo 'protocol P { associatedtype A = Int }; struct S: P {}' | swiftc -dump-ast -

This command dumps the type-checked AST (you can also pretty-print it as Swift source with -print-ast instead). Associated type inference deduces A := Int and adds an implicit type alias to S to serve as the implementation of the associated type.

2 Likes