Skip to content

Commit 243b91a

Browse files
authored
Merge pull request #9454 from slavapestov/se-0110-strikes-again
Sema: Fix another SE-0110 issue
2 parents 9640fab + f7bf7ac commit 243b91a

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

lib/SILGen/SILGenFunction.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ void SILGenFunction::emitCaptures(SILLocation loc,
196196

197197
case CaptureKind::Constant: {
198198
// let declarations.
199-
auto Entry = VarLocs[vd];
199+
auto found = VarLocs.find(vd);
200+
assert(found != VarLocs.end());
201+
auto Entry = found->second;
200202

201203
auto *var = cast<VarDecl>(vd);
202204
auto &tl = getTypeLowering(var->getType()->getReferenceStorageReferent());

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ void TypeChecker::configureInterfaceType(AbstractFunctionDecl *func,
899899

900900
Type selfTy;
901901
if (i == e-1 && hasSelf) {
902-
selfTy = func->computeInterfaceSelfType();
902+
selfTy = ParenType::get(Context, func->computeInterfaceSelfType());
903+
903904
// Substitute in our own 'self' parameter.
904905

905906
argTy = selfTy;

test/Constraints/function_conversion.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@ func existentialConversion(fn: @escaping (Refined) -> ()) {
2121
let _: (Base) -> () = fn
2222
let _: (Derived) -> () = fn
2323
}
24+
25+
// rdar://problem/31725325
26+
27+
func a<b>(_: [(String, (b) -> () -> Void)]) {}
28+
func a<b>(_: [(String, (b) -> () throws -> Void)]) {}
29+
30+
class c {
31+
func e() {}
32+
static var d = [("", e)]
33+
}
34+
a(c.d)
35+
36+
func b<T>(_: (T) -> () -> ()) {}
37+
38+
b(c.e)

test/Constraints/members.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
struct X {
88
func f0(_ i: Int) -> X { }
99

10-
func f1(_ i: Int) { } // expected-note {{found this candidate}}
10+
func f1(_ i: Int) { }
1111

12-
mutating func f1(_ f: Float) { } // expected-note {{found this candidate}}
12+
mutating func f1(_ f: Float) { }
1313

1414
func f2<T>(_ x: T) -> T { }
1515
}
@@ -28,9 +28,7 @@ func g0(_: (inout X) -> (Float) -> ()) {}
2828
_ = x.f0(i)
2929
x.f0(i).f1(i)
3030

31-
// FIXME: Is this a bug in Swift 4 mode?
3231
g0(X.f1)
33-
// expected-error@-1 {{ambiguous reference to member 'f1'}}
3432

3533
_ = x.f0(x.f2(1))
3634
_ = x.f0(1).f2(i)

0 commit comments

Comments
 (0)