@@ -3963,22 +3963,25 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
3963
3963
// Determine whether we can derive a witness for this requirement.
3964
3964
bool canDerive = false ;
3965
3965
3966
- // Can a witness for this requirement be derived for this nominal type?
3967
- if (auto derivable = DerivedConformance::getDerivableRequirement (
3968
- nominal,
3969
- requirement)) {
3970
- if (derivable == requirement) {
3971
- // If it's the same requirement, we can derive it here.
3972
- canDerive = true ;
3973
- } else {
3974
- // Otherwise, go satisfy the derivable requirement, which can introduce
3975
- // a member that could in turn satisfy *this* requirement.
3976
- auto derivableProto = cast<ProtocolDecl>(derivable->getDeclContext ());
3977
- auto conformance =
3978
- TypeChecker::conformsToProtocol (Adoptee, derivableProto,
3979
- DC->getParentModule ());
3980
- if (conformance.isConcrete ()) {
3981
- (void )conformance.getConcrete ()->getWitnessDecl (derivable);
3966
+ auto *SF = DC->getParentSourceFile ();
3967
+ if (!(SF == nullptr || SF->Kind == SourceFileKind::Interface)) {
3968
+ // Can a witness for this requirement be derived for this nominal type?
3969
+ if (auto derivable = DerivedConformance::getDerivableRequirement (
3970
+ nominal,
3971
+ requirement)) {
3972
+ if (derivable == requirement) {
3973
+ // If it's the same requirement, we can derive it here.
3974
+ canDerive = true ;
3975
+ } else {
3976
+ // Otherwise, go satisfy the derivable requirement, which can introduce
3977
+ // a member that could in turn satisfy *this* requirement.
3978
+ auto derivableProto = cast<ProtocolDecl>(derivable->getDeclContext ());
3979
+ auto conformance =
3980
+ TypeChecker::conformsToProtocol (Adoptee, derivableProto,
3981
+ DC->getParentModule ());
3982
+ if (conformance.isConcrete ()) {
3983
+ (void )conformance.getConcrete ()->getWitnessDecl (derivable);
3984
+ }
3982
3985
}
3983
3986
}
3984
3987
}
@@ -4288,6 +4291,10 @@ ResolveWitnessResult ConformanceChecker::resolveWitnessViaDerivation(
4288
4291
ValueDecl *requirement) {
4289
4292
assert (!isa<AssociatedTypeDecl>(requirement) && " Use resolveTypeWitnessVia*" );
4290
4293
4294
+ auto *SF = DC->getParentSourceFile ();
4295
+ if (SF != nullptr && SF->Kind == SourceFileKind::Interface)
4296
+ return ResolveWitnessResult::Missing;
4297
+
4291
4298
// Find the declaration that derives the protocol conformance.
4292
4299
NominalTypeDecl *derivingTypeDecl = nullptr ;
4293
4300
auto *nominal = Adoptee->getAnyNominal ();
0 commit comments