Hi compiler gurus,
I wonder if there are plans to add a "does X conform to Y" request to the request evaluator system (or other ways to unify conformance lookup logic)?
I'm curious because there multiple ways to perform conformance lookup (and find associated type witnesses), some of which have caused bugs for the differentiable programming project, which needs
Differentiable conformance lookup and associated type witness lookup during Sema, SILGen, and SIL transforms.
In my experience, the static function
TypeChecker::conformsToProtocol has been the most reliable way of obtaining a conformance (over
ModuleDecl::conformsToProtocol), but it is available only during Sema, not during SIL.
It's totally possible that the current system is fine and we're just using bad APIs -
TypeBase::getAutoDiffAssociatedTangentSpace(LookupConformanceFn lookupConformance) is one of the worst offenders, using
DependentMemberType::substBaseType and a
LookupConformanceFn to find associated type witnesses.
If anyone knows better ways for finding associated type witnesses (via APIs that work from SIL, not just Sema), that would be a big help too.