Skip to content

Commit 4544476

Browse files
authored
Merge pull request swiftlang#21656 from DougGregor/gsb-source-invalid-source-locs
2 parents a31f8c8 + 05fc089 commit 4544476

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6835,6 +6835,14 @@ void GenericSignatureBuilder::checkSameTypeConstraints(
68356835
auto locA = (*a)->constraint.source->getLoc();
68366836
auto locB = (*b)->constraint.source->getLoc();
68376837

6838+
// Put invalid locations after valid ones.
6839+
if (locA.isInvalid() || locB.isInvalid()) {
6840+
if (locA.isInvalid() != locB.isInvalid())
6841+
return locA.isInvalid() ? 1 : -1;
6842+
6843+
return 0;
6844+
}
6845+
68386846
auto bufferA = sourceMgr.findBufferContainingLoc(locA);
68396847
auto bufferB = sourceMgr.findBufferContainingLoc(locB);
68406848

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-swift-frontend -typecheck %s
2+
3+
protocol P1 {
4+
associatedtype A1
5+
}
6+
7+
protocol P2 {
8+
associatedtype A2
9+
}
10+
11+
struct S1<G1: P1, G2: P1>: P1 where G1.A1 == G2.A1 {
12+
typealias A1 = G1.A1
13+
}
14+
15+
struct S2<G1: P1, G2: P2>: P2 where G1.A1 == G2.A2 {
16+
typealias A2 = G2.A2
17+
}
18+
19+
struct S3<G1: P1, G2: P2> where G1.A1 == G2.A2 {
20+
func f<G: P1>(_: G) -> S3<S1<G, G1>, S2<G, G2>> {
21+
fatalError()
22+
}
23+
}

0 commit comments

Comments
 (0)