mirror of
https://github.com/apple/swift.git
synced 2026-10-02 10:58:03 +02:00
The opaque values test coverage I initially added will emit to stdout, which is noisy for people's logs if the test is failing for some other reason.
47 lines
1.3 KiB
Swift
47 lines
1.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %target-build-swift -module-name keypaths_resilient -emit-module %S/Inputs/keypaths_multi_file_c.swift -emit-module-path %t/keypaths_resilient.swiftmodule
|
|
|
|
// RUN: %target-swift-emit-silgen-ossa -o /dev/null -enable-sil-opaque-values -module-name keypaths -primary-file %s %S/Inputs/keypaths_multi_file_b.swift -I %t
|
|
// RUN: %target-swift-emit-silgen -module-name keypaths -primary-file %s %S/Inputs/keypaths_multi_file_b.swift -I %t | %FileCheck %s
|
|
// RUN: %target-swift-emit-silgen -module-name keypaths %s -primary-file %S/Inputs/keypaths_multi_file_b.swift -I %t | %FileCheck --check-prefix=DEFINITION %s
|
|
|
|
import keypaths_resilient
|
|
|
|
func foo(x: Int) -> KeyPath<A, Int> {
|
|
switch x {
|
|
case 0:
|
|
return \A.x
|
|
default:
|
|
return \A.[0]
|
|
}
|
|
return \A.x
|
|
}
|
|
|
|
// A.x setter
|
|
// CHECK-LABEL: sil hidden_external @$s8keypaths1AV1xSivs
|
|
// DEFINITION-LABEL: sil hidden [ossa] @$s8keypaths1AV1xSivs
|
|
|
|
// A.subscript setter
|
|
// CHECK-LABEL: sil hidden_external @$s8keypaths1AVyS2icis
|
|
// DEFINITION-LABEL: sil hidden [ossa] @$s8keypaths1AVyS2icis
|
|
|
|
func bar<T>(_: T) {
|
|
_ = \C<T>.b
|
|
_ = \C<T>[0]
|
|
|
|
_ = \D<T>.b
|
|
_ = \D<T>[0]
|
|
|
|
_ = \P.b
|
|
|
|
// FIXME: crashes
|
|
// _ = \P[0]
|
|
}
|
|
|
|
// https://github.com/apple/swift/issues/51158
|
|
class MM<T: P> : PP {}
|
|
func foo<T3: BB, T4: MM<T3>>(t: T3, u: T4) {
|
|
let _ = \CC<T4>.x
|
|
}
|