Files
swift-mirror/validation-test/Evolution/test_backward_deploy_conformance.swift
Joe Groff ca48939816 Compatibility51: Backport the 5.2 implementation of the conformance cache.
The runtime that shipped with Swift 5.1 and earlier had a bug that interfered with backward
deployment of binaries that dynamically check for protocol conformances on conditionally-available
tests. This was fixed in the top-of-tree Swift runtime by https://github.com/apple/swift/pull/29887;
however, that doesn't do much good for running binaries on older OSes that don't have that fix.
In order for binaries built with a newer Swift compiler to run successfully on older OSes,
introduce a compatibility hook that replaces the conformance cache implementation in the original
OS runtime with a version based on the current implementation that has the fix for the protocol
conformance bug. Fixes rdar://problem/59460603
2020-04-24 10:52:29 -07:00

28 lines
632 B
Swift

// RUN: %target-resilience-test --backward-deployment
// REQUIRES: executable_test
import StdlibUnittest
import backward_deploy_conformance
var BackwardDeployConformanceTest = TestSuite("BackwardDeployConformance")
public class UsesNewStruct: CustomStringConvertible {
public var field: NewStruct<Bool>? = nil
public let description = "This is my description"
}
public class OtherClass {}
@_optimize(none)
func blackHole<T>(_: T) {}
BackwardDeployConformanceTest.test("ConformanceCache") {
if getVersion() == 1 {
blackHole(UsesNewStruct())
}
blackHole(OtherClass() as? CustomStringConvertible)
}
runAllTests()