mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
After converting a function type to its corresponding SIL type by our usual rules, extract the substituted generic signature and common interface type for all concrete function types that the function could be called as. We don't currently have any use cases for distinguishing types at finer granularity than generic class-constrained/generic unconstrained/not-generic, so to reduce the amount of conversion noise in SIL, generate the most general generic signature possible, by extracting every position with a dependent generic parameter or associated type thereof into a separate generic parameter in the substituted signature, discarding all constraints except for `AnyObject` layout constraints. This way, if `foo<T>(x: (T, T) -> ())` calls `bar<T, U>(x: (T, U) -> ())` and forwards `x` along, the two closures that only vary in genericity don't need a conversion even with substituted function types, because they'll both have the same abstract lowering `<A, B> (A, B) -> ()` with different substitutions.
13 KiB
13 KiB