Files
swift-mirror/test/Interpreter/conditional_conformances.swift
Doug Gregor 4f8edeb913 [Runtime] Always fail to find a conditional conformance at runtime.
Proper evaluation of conditional conformances at runtime (e.g., as part of
dynamic casting) is too large to tackle in the Swift 4.1 timeframe. For now,
record that a conformance is conditional in the protocol conformance record,
and always return "does not conform" to such types.

Fixes rdar://problem/35761301.
2017-12-04 16:51:52 -08:00

39 lines
1.5 KiB
Swift

// RUN: %empty-directory(%t)
// The file that's `main` needs to be called that.
// RUN: cp %s %t/main.swift
// RUN: %target-build-swift -enable-experimental-conditional-conformances -D basic %t/main.swift %S/../Inputs/conditional_conformance_basic_conformances.swift -o %t/basic && %target-run %t/basic
// RUN: %target-build-swift -enable-experimental-conditional-conformances -D with_assoc %t/main.swift %S/../Inputs/conditional_conformance_with_assoc.swift -o %t/with_assoc && %target-run %t/with_assoc
// RUN: %target-build-swift -enable-experimental-conditional-conformances -D subclass %t/main.swift %S/../Inputs/conditional_conformance_subclass.swift -o %t/subclass && %target-run %t/subclass
// REQUIRES: executable_test
// Call the various functions from each of the IRGen conditional conformance
// tests. These can't be put in the file themselves because that changes it from
// being treated as a library to an executable.
#if basic
single_generic(IsP2.self)
single_concrete()
double_generic_generic(IsP2.self, IsP3.self)
double_generic_concrete(IsP2.self)
double_concrete_concrete()
assert(dynamicCastToP1(Single<IsP3>()) == nil)
assert(dynamicCastToP1(Single<IsP2>()) == nil) // FIXME: incorrect result!
#elseif with_assoc
generic_generic(IsAlsoP2.self, IsP3.self)
generic_concrete(IsAlsoP2.self)
concrete_generic(IsP3.self)
concrete_concrete()
#elseif subclass
subclassgeneric_generic(IsP2.self)
subclassgeneric_concrete()
subclassconcrete()
subclassgenericconcrete()
#endif