Skip to content

Commit 7139184

Browse files
committed
SILGen: Ensure +1 before reabstracting closure BB args.
Fixes rdar://83186202.
1 parent 4871212 commit 7139184

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
106106
argType = argType.getObjectType();
107107
}
108108

109-
if (argType != paramType) {
109+
if (argType.getASTType() != paramType.getASTType()) {
110110
// Reabstract the value if necessary.
111-
mv = SGF.emitOrigToSubstValue(loc, mv, orig, t);
111+
mv = SGF.emitOrigToSubstValue(loc, mv.ensurePlusOne(SGF, loc), orig, t);
112112
}
113113

114114
// If the value is a (possibly optional) ObjC block passed into the entry
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-emit-silgen -verify %s
2+
3+
// rdar://83186202
4+
5+
struct Butt {
6+
var foo: [Int: (Int, String, (Error?) -> Void)]
7+
8+
func bar() {
9+
_ = foo.lazy.compactMap { $0.value.0 }
10+
}
11+
}

0 commit comments

Comments
 (0)