Files
swift-mirror/validation-test/SILGen/rdar81421394.swift
Mike Ash 5928859970 [Test] Have rdar81421394.swift import Foundation.
This test occasionally fails due apparently not loading libswiftFoundation. The test relies on a bridging header to import the Foundation module, which seems iffy. Explicitly import Foundation instead.

rdar://114590327
2023-08-29 09:50:31 -04:00

46 lines
1.0 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-clang %S/Inputs/rdar81421394.m -I %S/Inputs -c -o %t/rdar81421394.o
// RUN: %target-build-swift -Xfrontend -disable-availability-checking -import-objc-header %S/Inputs/rdar81421394.h -Xlinker %t/rdar81421394.o %s -o %t/main
// RUN: %target-codesign %t/main
// RUN: %target-run %t/main | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: objc_interop
// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime
import Foundation
protocol RangeFinder {
var range: NSRange { get set }
}
extension Ranger : RangeFinder {}
class Wrapper {
let instance: Ranger<AnyObject, NSObject>
init() {
instance = Ranger()
}
var range: NSRange {
_read {
yield instance.range
}
_modify {
print("staring modify")
yield &instance.range
print("ending modify")
}
}
}
let w = Wrapper()
print("begin:", w.range)
// CHECK: begin: {0, 0}
w.range = NSRange(location: 3, length: 5)
// CHECK: end: {3, 5}
print("end:", w.range)