Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions test/Interpreter/Inputs/dynamic_replacement_opaque1.swift
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
protocol P {
func myValue() -> Int
func myValue() -> Int64
}

extension Int: P {
public func myValue() -> Int {
extension Int64: P {
public func myValue() -> Int64 {
return self
}

}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
func bar(_ x: Int) -> some P {
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func bar(_ x: Int64) -> some P {
return x
}

struct Container {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
func bar(_ x: Int) -> some P {
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func bar(_ x: Int64) -> some P {
return x
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
var computedProperty : some P {
get {
return 2
return Int64(2)
}
set {
print("original \(newValue)")
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
subscript(_ x: Int) -> some P {
get {
return 2
return Int64(2)
}
set {
print("original \(newValue)")
Expand All @@ -45,17 +45,17 @@ protocol Q {}

struct NewType : Q {}

extension Int : Q {}
extension Int64 : Q {}

public protocol Assoc {
associatedtype A = Int
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func act() -> A
}

struct Test : Assoc {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func act() -> some Q {
return 1
return Int64(1)
}
}
20 changes: 10 additions & 10 deletions test/Interpreter/Inputs/dynamic_replacement_opaque2.swift
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
@_private(sourceFile: "TestOpaque1.swift") import TestOpaque1

struct Pair : P {
var x = 0
var y = 1
func myValue() -> Int{
var x = Int64(0)
var y = Int64(1)
func myValue() -> Int64 {
return y
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for:bar(_:))
func _replacement_bar(y x: Int) -> some P {
func _replacement_bar(y x: Int64) -> some P {
return Pair()
}

extension Container {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for:bar(_:))
func _replacement_bar(y x: Int) -> some P {
func _replacement_bar(y x: Int64) -> some P {
return Pair()
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: computedProperty)
var _replacement_computedProperty : some P {
get {
Expand All @@ -32,7 +32,7 @@ extension Container {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: subscript(_:))
subscript(y x: Int) -> some P {
get {
Expand All @@ -45,7 +45,7 @@ extension Container {
}

extension Test {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: act)
func act_r() -> some Q {
return NewType()
Expand Down
2 changes: 1 addition & 1 deletion test/Interpreter/SDK/SwiftNativeNSXXXCoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private func test<T: NSObject & NSCoding>(type: T.Type) {
// Test all the classes listed in SwiftNativeNSXXXBase.mm.gyb except for
// NSEnumerator (which doesn't conform to NSCoding).

if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
testSuite.test("NSArray") {
test(type: NSArray.self)
}
Expand Down
2 changes: 1 addition & 1 deletion test/Interpreter/SDK/check_class_for_archiving.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ print("DerivedClassWithName: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeye
// CHECK: NSKeyedUnarchiver: 0
print("NSKeyedUnarchiver: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NSKeyedUnarchiver.self, operation: op))")

if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
// CHECK: PrivateClass: 2
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
// CHECK: GenericClass: 1
Expand Down
2 changes: 1 addition & 1 deletion test/Interpreter/SDK/check_class_for_archiving_log.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import Foundation

// A tricky way to make the FileCheck tests conditional on the OS version.
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
print("-check-prefix=CHECK")
} else {
// Disable the checks for older OSes because of rdar://problem/50504765
Expand Down
4 changes: 2 additions & 2 deletions test/Interpreter/SDK/objc_getClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ testSuite.test("GenericMangled")
reason: "objc_getClass hook not present"))
.requireOwnProcess()
.code {
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
guard #available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) else { return }
requireClass(named: "_TtC4main24ConstrainedSwiftSubclass",
demangledName: "main.ConstrainedSwiftSubclass")
requireClass(named: "_TtC4main26ConstrainedSwiftSuperclass",
Expand Down Expand Up @@ -226,7 +226,7 @@ testSuite.test("ResilientNSObject")
reason: "objc_getClass hook not present"))
.requireOwnProcess()
.code {
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
guard #available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) else { return }
requireClass(named: "_TtC4main27ResilientSubclassOfNSObject",
demangledName: "main.ResilientSubclassOfNSObject")
requireClass(named: "_TtC4main34ResilientSubclassOfGenericNSObject",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ func replaceable1_r() -> Int {
return 2
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
dynamic func bar1(_ x: Int) -> some P {
return x
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: bar1(_:))
func bar1_r(_ x: Int) -> some P {
return Pair()
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
dynamic func bar2(_ x: Int) -> some P {
return x
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: bar2(_:))
func bar2_r(_ x: Int) -> some P {
return Pair()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ func replaceable2_r() -> Int {
return 3
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
dynamic func bar3(_ x: Int) -> some P {
return x
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: bar3(_:))
func bar3_r(_ x: Int) -> some P {
return Pair()
Expand Down
7 changes: 3 additions & 4 deletions test/Interpreter/dynamic_replacement_multifile/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ struct Pair {

extension Pair : P {}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
dynamic func bar(_ x: Int) -> some P {
return x
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: bar(_:))
func bar_r(_ x: Int) -> some P {
return Pair()
Expand All @@ -52,13 +52,12 @@ DynamicallyReplaceable.test("DynamicallyReplaceable") {
expectEqual(2, replaceable1())
expectEqual(3, replaceable2())
expectEqual(7, replaceableInOtherFile())
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
expectEqual(16, MemoryLayout.size(ofValue: bar(5)))
expectEqual(16, MemoryLayout.size(ofValue: bar1(5)))
expectEqual(16, MemoryLayout.size(ofValue: bar2(5)))
expectEqual(16, MemoryLayout.size(ofValue: bar3(5)))
}

}

runAllTests()
6 changes: 3 additions & 3 deletions test/Interpreter/dynamic_replacement_opaque_result.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func testAssociatedType<T: Assoc> (_ t: T) {
print(T.A.self)
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func test() {
print(MemoryLayout.size(ofValue: bar(5)))
print(MemoryLayout.size(ofValue: Container().bar(5)))
Expand All @@ -56,7 +56,7 @@ func test() {
// CHECK: 2
// CHECK: 8
// CHECK: 2
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
test()
} else {
print("8 8 5 5 8 2 8 2")
Expand All @@ -82,7 +82,7 @@ executablePath.removeLast(4)
// CHECK: 16
// CHECK: 1
// CHECK: NewType
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
test()
testAssociatedType(Test())
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/Interpreter/dynamic_replacement_opaque_result2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public protocol Assoc {
associatedtype A = Int

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func act() -> A
}

Expand All @@ -29,14 +29,14 @@ extension Int : P {
struct Pair : P {}

struct Test : Assoc {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
dynamic func act() -> some P {
return 1
}
}

extension Test {
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@_dynamicReplacement(for: act)
func act_r() -> some P {
return Pair()
Expand All @@ -46,7 +46,7 @@ extension Test {
func test() {
let t = Test()
// CHECK: Pair
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
testAssociatedType(t)
} else {
print("Pair")
Expand Down
16 changes: 8 additions & 8 deletions test/Interpreter/opaque_return_type_protocol_ext.swift
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
// RUN: %target-run-simple-swift | %FileCheck %s
// REQUIRES: executable_test

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
protocol P {
associatedtype AT
func foo() -> AT
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
struct Adapter<T: P>: P {
var inner: T

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
func foo() -> some P {
return inner
}
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
extension P {
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
func foo() -> some P {
return Adapter(inner: self)
}
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
func getPAT<T: P>(_: T.Type) -> Any.Type {
return T.AT.self
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
extension Int: P { }

// CHECK: {{Adapter<Int>|too old}}
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
print(getPAT(Int.self))
} else {
print("i'm getting too old for this sh")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func getAssocSubscriptType<T: AssocTypeInference>(_ x: T) -> T.AssocSubscript {
struct MyFoo: Foo {}
struct YourFoo: Foo {}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func someTypeIsTheSame() {
var a = foo(0)
a = foo(0)
Expand Down
Loading