@@ -4733,23 +4733,16 @@ ResolveWitnessResult ConformanceChecker::resolveTypeWitnessViaLookup(
4733
4733
// of 'Never' if it is declared in a context that does not satisfy the
4734
4734
// requirements of the conformance context.
4735
4735
//
4736
- // FIXME: If SwiftUI redeclares the typealias under the correct constraints,
4737
- // this can be removed.
4736
+ // FIXME: Remove this eventually.
4738
4737
bool skipRequirementCheck = false ;
4739
4738
if (auto *typeAliasDecl = dyn_cast<TypeAliasDecl>(typeDecl)) {
4740
- if (typeAliasDecl->getUnderlyingType ()->isNever ()) {
4741
- if (typeAliasDecl->getParentModule ()->getName ().is (" SwiftUI" )) {
4739
+ if (typeAliasDecl->getParentModule ()->getName ().is (" SwiftUI" ) &&
4740
+ typeAliasDecl->getParentSourceFile () &&
4741
+ typeAliasDecl->getParentSourceFile ()->Kind == SourceFileKind::Interface) {
4742
+ if (typeAliasDecl->getUnderlyingType ()->isNever ()) {
4742
4743
if (typeAliasDecl->getDeclContext ()->getSelfNominalTypeDecl () ==
4743
4744
DC->getSelfNominalTypeDecl ()) {
4744
- const auto reqs =
4745
- typeAliasDecl->getGenericSignature ().requirementsNotSatisfiedBy (
4746
- DC->getGenericSignatureOfContext ());
4747
- if (!reqs.empty ()) {
4748
- SwiftUIInvalidTyWitness = {assocType, typeAliasDecl,
4749
- reqs.front ()};
4750
-
4751
- skipRequirementCheck = true ;
4752
- }
4745
+ skipRequirementCheck = true ;
4753
4746
}
4754
4747
}
4755
4748
}
@@ -5423,32 +5416,6 @@ void ConformanceChecker::checkConformance(MissingWitnessDiagnosisKind Kind) {
5423
5416
if (Conformance->isInvalid ()) {
5424
5417
return ;
5425
5418
}
5426
-
5427
- // As a narrow fix for a source compatibility issue with SwiftUI's
5428
- // swiftinterface, but only if the conformance succeeds, warn about an
5429
- // actually malformed conformance if we recorded a 'typealias' type witness
5430
- // with an underlying type of 'Never', which resides in a context that does
5431
- // not satisfy the requirements of the conformance context.
5432
- //
5433
- // FIXME: If SwiftUI redeclares the typealias under the correct constraints,
5434
- // this can be removed.
5435
- if (SwiftUIInvalidTyWitness) {
5436
- const auto &info = SwiftUIInvalidTyWitness.getValue ();
5437
- const auto &failedReq = info.FailedReq ;
5438
-
5439
- auto &diags = getASTContext ().Diags ;
5440
- diags.diagnose (Loc, diag::type_does_not_conform_swiftui_warning, Adoptee,
5441
- Proto->getDeclaredInterfaceType ());
5442
- diags.diagnose (info.AssocTypeDecl , diag::no_witnesses_type,
5443
- info.AssocTypeDecl ->getName ());
5444
-
5445
- if (failedReq.getKind () != RequirementKind::Layout) {
5446
- diags.diagnose (info.TypeWitnessDecl ,
5447
- diag::protocol_type_witness_missing_requirement,
5448
- failedReq.getFirstType (), failedReq.getSecondType (),
5449
- (unsigned )failedReq.getKind ());
5450
- }
5451
- }
5452
5419
}
5453
5420
5454
5421
// / Retrieve the Objective-C method key from the given function.
0 commit comments