@@ -4733,23 +4733,16 @@ ResolveWitnessResult ConformanceChecker::resolveTypeWitnessViaLookup(
47334733 // of 'Never' if it is declared in a context that does not satisfy the
47344734 // requirements of the conformance context.
47354735 //
4736- // FIXME: If SwiftUI redeclares the typealias under the correct constraints,
4737- // this can be removed.
4736+ // FIXME: Remove this eventually.
47384737 bool skipRequirementCheck = false ;
47394738 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 ()) {
47424743 if (typeAliasDecl->getDeclContext ()->getSelfNominalTypeDecl () ==
47434744 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 ;
47534746 }
47544747 }
47554748 }
@@ -5423,32 +5416,6 @@ void ConformanceChecker::checkConformance(MissingWitnessDiagnosisKind Kind) {
54235416 if (Conformance->isInvalid ()) {
54245417 return ;
54255418 }
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- }
54525419}
54535420
54545421// / Retrieve the Objective-C method key from the given function.
0 commit comments