Skip to content

Commit 5b6f5d9

Browse files
authored
Merge pull request #36983 from slavapestov/layout-requirement-implied-by-concrete-5.5
GSB: When rebuilding a signature, drop layout requirements implied by concrete as well [5.5]
2 parents 6afa3bd + 8d04e63 commit 5b6f5d9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6465,6 +6465,12 @@ void GenericSignatureBuilder::computeRedundantRequirements() {
64656465
if (resolvedConcreteType) {
64666466
if (typeImpliesLayoutConstraint(resolvedConcreteType, layout)) {
64676467
impliedByConcrete.push_back(constraint);
6468+
6469+
if (!source->isDerivedRequirement()) {
6470+
Impl->ExplicitConformancesImpliedByConcrete.insert(
6471+
ExplicitRequirement::fromExplicitConstraint(
6472+
RequirementKind::Layout, constraint));
6473+
}
64686474
}
64696475
}
64706476

test/Generics/rdar76750100.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %target-typecheck-verify-swift -disable-objc-attr-requires-foundation-module -enable-objc-interop
2+
// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -debug-generic-signatures -enable-objc-interop -typecheck %s 2>&1 | %FileCheck %s
3+
4+
@objc protocol P1 {}
5+
@objc protocol P2 : P1 {}
6+
7+
class G<X : P1, Y : AnyObject> {}
8+
9+
class C {}
10+
11+
// CHECK-LABEL: Generic signature: <X, Y where X == P2, Y == C>
12+
extension G where X == P2, Y == C {
13+
func foo() {}
14+
}

0 commit comments

Comments
 (0)