Skip to content

Commit a91cb28

Browse files
committed
Ban conversion between function types of different lifetime dependencies
1 parent eb51b6f commit a91cb28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3248,6 +3248,10 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
32483248
if (!matchFunctionIsolations(func1, func2, kind, flags, locator))
32493249
return getTypeMatchFailure(locator);
32503250

3251+
if (func1->getLifetimeDependenceInfo() != func2->getLifetimeDependenceInfo()) {
3252+
return getTypeMatchFailure(locator);
3253+
}
3254+
32513255
// To contextual type increase the score to avoid ambiguity when solver can
32523256
// find more than one viable binding different only in representation e.g.
32533257
// let _: (@convention(block) () -> Void)? = Bool.random() ? nil : {}

0 commit comments

Comments
 (0)