Skip to content

Commit 3e4cb1c

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 301dbbf + 6a7b7ad commit 3e4cb1c

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,10 @@ static SILFunction *getOrCreateKeyPathGetter(SILGenModule &SGM,
26722672
auto genericSig = genericEnv
26732673
? genericEnv->getGenericSignature()->getCanonicalSignature()
26742674
: nullptr;
2675+
if (genericSig && genericSig->areAllParamsConcrete()) {
2676+
genericSig = nullptr;
2677+
genericEnv = nullptr;
2678+
}
26752679

26762680
// Build the signature of the thunk as expected by the keypath runtime.
26772681
CanType loweredBaseTy, loweredPropTy;
@@ -2801,6 +2805,11 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
28012805
? genericEnv->getGenericSignature()->getCanonicalSignature()
28022806
: nullptr;
28032807

2808+
if (genericSig && genericSig->areAllParamsConcrete()) {
2809+
genericSig = nullptr;
2810+
genericEnv = nullptr;
2811+
}
2812+
28042813
// Build the signature of the thunk as expected by the keypath runtime.
28052814
CanType loweredBaseTy, loweredPropTy;
28062815
{
@@ -2957,6 +2966,11 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
29572966
? genericEnv->getGenericSignature()->getCanonicalSignature()
29582967
: nullptr;
29592968

2969+
if (genericSig && genericSig->areAllParamsConcrete()) {
2970+
genericSig = nullptr;
2971+
genericEnv = nullptr;
2972+
}
2973+
29602974
auto &C = SGM.getASTContext();
29612975
auto unsafeRawPointerTy = C.getUnsafeRawPointerDecl()->getDeclaredType()
29622976
->getCanonicalType();

lib/SILGen/SILGenPoly.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,17 +3327,20 @@ SILGenFunction::createWithoutActuallyEscapingClosure(
33273327

33283328
// Create it in our current function.
33293329
auto thunkValue = B.createFunctionRefFor(loc, thunk);
3330+
3331+
// Create a copy for the noescape value, so we can mark_dependence upon the
3332+
// original value.
33303333
SILValue noEscapeValue =
3331-
noEscapingFunctionValue.ensurePlusOne(*this, loc).forward(*this);
3334+
noEscapingFunctionValue.copy(*this, loc).forward(*this);
33323335
SingleValueInstruction *thunkedFn = B.createPartialApply(
33333336
loc, thunkValue,
33343337
SILType::getPrimitiveObjectType(substFnTy),
33353338
interfaceSubs,
33363339
noEscapeValue,
33373340
SILType::getPrimitiveObjectType(escapingFnTy));
33383341
// We need to ensure the 'lifetime' of the trivial values context captures. As
3339-
// long as we rerpresent these captures by the same value the following works.
3340-
thunkedFn = B.createMarkDependence(loc, thunkedFn, noEscapeValue);
3342+
// long as we represent these captures by the same value the following works.
3343+
thunkedFn = B.createMarkDependence(loc, thunkedFn, noEscapingFunctionValue.getValue());
33413344

33423345
return emitManagedRValueWithCleanup(thunkedFn);
33433346
}

test/Interpreter/enforce_exclusive_access.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -swift-version 4 %s -o %t/a.out -enforce-exclusivity=checked -Onone
2+
// RUN: %target-build-swift -Xfrontend -verify-sil-ownership -swift-version 4 %s -o %t/a.out -enforce-exclusivity=checked -Onone
33
//
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out

test/SILGen/keypath_property_descriptors.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,17 @@ public struct FixedLayout {
154154
// RESILIENT-LABEL: sil_property #FixedLayout.c (stored_property
155155
public var c: Int
156156
}
157+
158+
public class Foo {}
159+
extension Array where Element == Foo {
160+
public class Bar {
161+
// NONRESILIENT-LABEL: sil_property #Array.Bar.dontCrash<τ_0_0 where τ_0_0 == Foo> (settable_property $Int
162+
public private(set) var dontCrash : Int {
163+
get {
164+
return 10
165+
}
166+
set {
167+
}
168+
}
169+
}
170+
}

0 commit comments

Comments
 (0)