Skip to content

Commit 69b12d0

Browse files
committed
---
yaml --- r: 323549 b: refs/heads/tensorflow-next c: 512613f h: refs/heads/master i: 323547: f9138d8
1 parent 854d095 commit 69b12d0

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: 0cb1b2cb162496ef33b397befb713b4d820e68fd
1464+
refs/heads/tensorflow-next: 512613f8ffa53c33efdda14c8ecdcb1763dfea5c

branches/tensorflow-next/lib/Sema/TypeCheckConstraints.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ bool constraints::computeTupleShuffle(ArrayRef<TupleTypeElt> fromTuple,
180180
Expr *ConstraintLocatorBuilder::trySimplifyToExpr() const {
181181
SmallVector<LocatorPathElt, 4> pathBuffer;
182182
Expr *anchor = getLocatorParts(pathBuffer);
183+
// Locators are not guaranteed to have an anchor
184+
// if constraint system is used to verify generic
185+
// requirements.
186+
if (!anchor)
187+
return nullptr;
188+
183189
ArrayRef<LocatorPathElt> path = pathBuffer;
184190

185191
SourceRange range;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
typealias T1 = Int
4+
typealias T2 = Float
5+
typealias T3 = Bool
6+
7+
protocol P {
8+
associatedtype R
9+
static var foo: (T1, (R) -> T2) { get }
10+
}
11+
12+
extension P {
13+
static func bind() -> (T1, (R) -> T3) {
14+
return (1, { _ in true })
15+
}
16+
}
17+
18+
struct S: P {
19+
typealias R = T3
20+
21+
static let foo: (T1, (R) -> T2) = bind()
22+
// expected-error@-1 {{cannot convert value of type '(T1, (S.R) -> T3)' (aka '(Int, (Bool) -> Bool)') to specified type '(T1, (S.R) -> T2)' (aka '(Int, (Bool) -> Float)')}}
23+
}

0 commit comments

Comments
 (0)