Skip to content

Commit 6b7d300

Browse files
committed
Fix lifetime inference with older .swiftinterface files.
This was fix was accidentally not include in the previous commit, which breaks older .swiftinterface files without it: commit 75ba7a8 Merge: befc15e d41c4d4 Author: Andrew Trick <[email protected]> Date: Wed Mar 19 18:22:35 2025 Merge pull request #80064 from atrick/lifetime-inference LifetimeDependence: implement strict type checking
1 parent 1b1274f commit 6b7d300

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/AST/LifetimeDependence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class LifetimeDependenceChecker {
334334
// TODO: remove this check once all compilers that are rev-locked to the
335335
// stdlib print the 'copy' dependence kind in the interface (Aug '25)
336336
if (auto *sf = afd->getParentSourceFile()) {
337-
if (sf->Kind == SourceFileKind::SIL) {
337+
if (sf->Kind == SourceFileKind::Interface) {
338338
return true;
339339
}
340340
}

test/SIL/Parser/lifetime_dependence.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct BufferView : ~Escapable {
1818
@lifetime(borrow x)
1919
func derive(_ x: borrowing BufferView) -> BufferView
2020

21-
@lifetime(x)
21+
@lifetime(copy x)
2222
func consumeAndCreate(_ x: consuming BufferView) -> BufferView
2323

2424
sil hidden [unsafe_nonescapable_result] @bufferviewinit1 : $@convention(method) (UnsafeRawBufferPointer, @thin BufferView.Type) -> @owned BufferView {

0 commit comments

Comments
 (0)