mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The `-force-single-frontend-invocation` flag predates WMO and is now an alias for `-whole-module-optimization`. We should use the latter and let the former fade into history.
31 lines
1.2 KiB
Swift
31 lines
1.2 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -emit-library -c %S/Inputs/testability_helper.swift -enable-testing -whole-module-optimization -o %t/testability_helper.o -emit-module
|
|
|
|
// RUN: %target-build-swift %s -I %t -Xlinker %t/testability_helper.o -o %t/main
|
|
// RUN: %target-codesign %t/main
|
|
// RUN: %target-run %t/main | %FileCheck %s
|
|
// REQUIRES: executable_test
|
|
|
|
@testable import testability_helper
|
|
|
|
func log(_ value: Any, line: Int = #line) {
|
|
print("\(line): \(value)")
|
|
}
|
|
|
|
log(Base(1)) // CHECK: {{^}}[[@LINE]]: instance 1{{$}}
|
|
log(Base(2).description) // CHECK: {{^}}[[@LINE]]: instance 2{{$}}
|
|
log((Base(3) as CustomStringConvertible).description) // CHECK: {{^}}[[@LINE]]: instance 3{{$}}
|
|
|
|
class Sub : Base {
|
|
override var description: String {
|
|
return "sub " + super.description
|
|
}
|
|
}
|
|
|
|
log(Sub(1)) // CHECK: {{^}}[[@LINE]]: sub instance 1{{$}}
|
|
log(Sub(2) as Any as? Base) // CHECK: {{^}}[[@LINE]]: Optional(sub instance 2){{$}}
|
|
|
|
log(Base(1).callPrivate()) // CHECK: {{^}}[[@LINE]]: private 1{{$}}
|
|
log(Sub(2).callPrivate()) // CHECK: {{^}}[[@LINE]]: private 2{{$}}
|
|
log(getPrivateInstance().callPrivate()) // CHECK: {{^}}[[@LINE]]: really private{{$}}
|