Files
swift-mirror/validation-test/SILGen/rdar179316467.swift
Erik Eckstein 3243f87204 tests: remove the lit feature swift_in_compiler
Tests require the compiler built with SwiftCompilerSources since a long time.
So this lit feature was redundant anyway. We can remove it.
2026-06-30 14:47:56 +02:00

33 lines
859 B
Swift

// RUN: %target-swift-emit-silgen -sil-verify-all -enable-library-evolution -enable-experimental-feature Lifetimes %s
// RUN: %target-swift-emit-sil -sil-verify-all -enable-library-evolution -enable-experimental-feature Lifetimes -verify %s
// REQUIRES: swift_feature_Lifetimes
// REQUIRES: objc_interop
import Foundation
public struct SK {
var obj: AnyObject = NSObject()
public init<D: DataProtocol>(data: D) {}
public var bytes: RawSpan {
@_lifetime(borrow self)
_read {
yield _overrideLifetime(RawSpan(), borrowing: self)
}
}
}
public func consume(data: RawSpan, using key: SK) {}
public func extract(input: SK, salt: Data) {
let key: SK
if salt.regions.count != 1 {
let bytes = Array(salt)
key = SK(data: bytes)
} else {
key = SK(data: salt.regions.first!)
}
consume(data: input.bytes, using: key)
}