mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
LLVM r336847 changed FileCheck's CHECK-DAG feature to stop supporting overlapping matches. I already fixed one test by invoking FileCheck with the -allow-deprecated-dag-overlap option, but it turns out there are a bunch more of them. This change applies the same workaround to all of them.
54 lines
1.9 KiB
Swift
54 lines
1.9 KiB
Swift
|
|
// RUN: %target-swift-frontend -module-name generic_args -primary-file %s -emit-ir -verify -g -o - | %FileCheck %s -allow-deprecated-dag-overlap
|
|
|
|
func markUsed<T>(_ t: T) {}
|
|
|
|
protocol AProtocol {
|
|
func f() -> String
|
|
}
|
|
class AClass : AProtocol {
|
|
func f() -> String { return "A" }
|
|
}
|
|
class AnotherClass : AProtocol {
|
|
func f() -> String { return "B" }
|
|
}
|
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "$Sq_D",{{.*}} elements: ![[PROTOS:[0-9]+]]
|
|
// CHECK-DAG: ![[PROTOS]] = !{![[INHERIT:.*]]}
|
|
// CHECK-DAG: ![[INHERIT]] = !DIDerivedType(tag: DW_TAG_inheritance,{{.*}} baseType: ![[PROTOCOL:[0-9]+]]
|
|
// CHECK-DAG: ![[PROTOCOL]] = !DICompositeType(tag: DW_TAG_structure_type, name: "$S12generic_args9AProtocol_pmD",
|
|
// CHECK-DAG: !DILocalVariable(name: "x", arg: 1,{{.*}} type: ![[T:.*]])
|
|
// CHECK-DAG: ![[T]] = !DICompositeType(tag: DW_TAG_structure_type, name: "$SxD"
|
|
// CHECK-DAG: !DILocalVariable(name: "y", arg: 2,{{.*}} type: ![[Q:.*]])
|
|
// CHECK-DAG: ![[Q]] = !DICompositeType(tag: DW_TAG_structure_type, name: "$Sq_D"
|
|
func aFunction<T : AProtocol, Q : AProtocol>(_ x: T, _ y: Q, _ z: String) {
|
|
markUsed("I am in \(z): \(x.f()) \(y.f())")
|
|
}
|
|
|
|
aFunction(AClass(),AnotherClass(),"aFunction")
|
|
|
|
struct Wrapper<T: AProtocol> {
|
|
|
|
init<U>(from : Wrapper<U>) {
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "Wrapper",{{.*}} identifier: "$S12generic_args7WrapperVyqd__GD")
|
|
var wrapped = from
|
|
wrapped = from
|
|
_ = wrapped
|
|
}
|
|
|
|
func passthrough(_ t: T) -> T {
|
|
// CHECK-DAG: ![[WRAPPER:.*]] = !DICompositeType({{.*}}identifier: "$S12generic_args7WrapperVyxGD")
|
|
// CHECK-DAG: !DILocalVariable(name: "local",{{.*}} line: [[@LINE+1]],{{.*}} type: ![[T]]
|
|
var local = t
|
|
local = t
|
|
return local
|
|
}
|
|
}
|
|
|
|
// CHECK-DAG: ![[FNTY:.*]] = !DICompositeType({{.*}}identifier: "$Sxq_Ignr_D"
|
|
// CHECK-DAG: !DILocalVariable(name: "f", {{.*}}, line: [[@LINE+1]], type: ![[FNTY]])
|
|
func apply<T, U> (_ x: T, f: (T) -> (U)) -> U {
|
|
return f(x)
|
|
}
|
|
|