mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: TypeChecker::conformsToProtocol() => ModuleDecl::checkConformance()
This commit is contained in:
@@ -1461,14 +1461,14 @@ static bool optimizeStaticallyKnownProtocolConformance(
|
||||
// SourceType is a non-existential type with a non-conditional
|
||||
// conformance to a protocol represented by the TargetType.
|
||||
//
|
||||
// TypeChecker::conformsToProtocol checks any conditional conformances. If
|
||||
// ModuleDecl::checkConformance() checks any conditional conformances. If
|
||||
// they depend on information not known until runtime, the conformance
|
||||
// will not be returned. For instance, if `X: P` where `T == Int` in `func
|
||||
// foo<T>(_: T) { ... X<T>() as? P ... }`, the cast will succeed for
|
||||
// `foo(0)` but not for `foo("string")`. There are many cases where
|
||||
// everything is completely static (`X<Int>() as? P`), in which case a
|
||||
// valid conformance will be returned.
|
||||
auto Conformance = SM->conformsToProtocol(SourceType, Proto);
|
||||
auto Conformance = SM->checkConformance(SourceType, Proto);
|
||||
if (Conformance.isInvalid())
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user