Skip to content

Commit 8b02bd7

Browse files
committed
Fix addressable_dependencies.swift test.
Use _overrideLifetime to avoid a diagnostic error.
1 parent 762cdc4 commit 8b02bd7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/SILOptimizer/addressable_dependencies.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-sil -enable-experimental-feature BuiltinModule -enable-experimental-feature LifetimeDependence -enable-experimental-feature AddressableTypes -enable-experimental-feature ValueGenerics %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-sil -disable-access-control -enable-experimental-feature BuiltinModule -enable-experimental-feature LifetimeDependence -enable-experimental-feature AddressableTypes -enable-experimental-feature ValueGenerics %s | %FileCheck %s
22

33
// REQUIRES: swift_feature_BuiltinModule
44
// REQUIRES: swift_feature_AddressableTypes
@@ -69,12 +69,14 @@ struct Schmector {
6969
// CHECK-SAME: (@in_guaranteed Schmector) ->
7070
@lifetime(borrow self)
7171
borrowing get {
72-
return Spam(base: UnsafePointer(Builtin.addressOfBorrow(self)), count: 10)
72+
let pointer = UnsafePointer<Int>(Builtin.addressOfBorrow(self))
73+
let spam = Spam(base: pointer, count: 10)
74+
return _overrideLifetime(spam, borrowing: self)
7375
}
7476
}
7577
}
7678

7779
struct Spam: ~Escapable {
78-
@_unsafeNonescapableResult
80+
@lifetime(borrow base)
7981
init(base: UnsafePointer<Int>, count: Int) {}
8082
}

0 commit comments

Comments
 (0)