Skip to content

Commit fab7ff0

Browse files
authored
Merge pull request #59795 from slavapestov/remove-swiftui-type-witness-hack
Sema: Remove SwiftUI type witness matching compatibility hack
2 parents fb7b639 + 4ed1de5 commit fab7ff0

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

lib/Sema/AssociatedTypeInference.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -423,26 +423,6 @@ static ResolveWitnessResult resolveTypeWitnessViaLookup(
423423
if (genericDecl->isGeneric())
424424
continue;
425425

426-
// As a narrow fix for a source compatibility issue with SwiftUI's
427-
// swiftinterface, allow a 'typealias' type witness with an underlying type
428-
// of 'Never' if it is declared in a context that does not satisfy the
429-
// requirements of the conformance context.
430-
//
431-
// FIXME: Remove this eventually.
432-
bool skipRequirementCheck = false;
433-
if (auto *typeAliasDecl = dyn_cast<TypeAliasDecl>(typeDecl)) {
434-
if (typeAliasDecl->getParentModule()->getName().is("SwiftUI") &&
435-
typeAliasDecl->getParentSourceFile() &&
436-
typeAliasDecl->getParentSourceFile()->Kind == SourceFileKind::Interface) {
437-
if (typeAliasDecl->getUnderlyingType()->isNever()) {
438-
if (typeAliasDecl->getDeclContext()->getSelfNominalTypeDecl() ==
439-
dc->getSelfNominalTypeDecl()) {
440-
skipRequirementCheck = true;
441-
}
442-
}
443-
}
444-
}
445-
446426
// Skip typealiases with an unbound generic type as their underlying type.
447427
if (auto *typeAliasDecl = dyn_cast<TypeAliasDecl>(typeDecl))
448428
if (typeAliasDecl->getDeclaredInterfaceType()->is<UnboundGenericType>())
@@ -461,8 +441,7 @@ static ResolveWitnessResult resolveTypeWitnessViaLookup(
461441

462442
// If the type comes from a constrained extension or has a 'where'
463443
// clause, check those requirements now.
464-
if (!skipRequirementCheck &&
465-
!TypeChecker::checkContextualRequirements(
444+
if (!TypeChecker::checkContextualRequirements(
466445
genericDecl, dc->getSelfInterfaceType(), SourceLoc(),
467446
dc->getParentModule(), dc->getGenericSignatureOfContext())) {
468447
continue;

0 commit comments

Comments
 (0)