mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix the common error of using underscores instead of dashes. In the rebranch this is an error (lit got more picky), but it also makes sense to fix the tests in the main branch
50 lines
2.3 KiB
Swift
50 lines
2.3 KiB
Swift
// RUN: %target-swift-ide-test -conforming-methods -source-filename %s -code-completion-token=TEST_1 -module-name MyModule -conforming-methods-expected-types '$s8MyModule7Target1PD' -conforming-methods-expected-types '$s8MyModule7Target2PD' | %FileCheck %s -check-prefix=CHECK_1
|
|
// RUN: %target-swift-ide-test -conforming-methods -source-filename %s -code-completion-token=TEST_2 -module-name MyModule -conforming-methods-expected-types '$s8MyModule7Target1PD' -conforming-methods-expected-types '$s8MyModule7Target2PD' | %FileCheck %s -check-prefix=CHECK_1
|
|
// RUN: %target-swift-ide-test -conforming-methods -source-filename %s -code-completion-token=TEST_3 -module-name MyModule -conforming-methods-expected-types '$s8MyModule7Target1PD' -conforming-methods-expected-types '$s8MyModule7Target2PD' | %FileCheck %s -check-prefix=CHECK_1
|
|
// RUN: %target-swift-ide-test -conforming-methods -source-filename %s -code-completion-token=TEST_4 -module-name MyModule -conforming-methods-expected-types '$s8MyModule7Target1PD' -conforming-methods-expected-types '$s8MyModule7Target2PD' | %FileCheck %s -check-prefix=CHECK_1
|
|
|
|
protocol Target1 {
|
|
associatedType Assoc
|
|
}
|
|
protocol Target2 {}
|
|
protocol Target3 {}
|
|
|
|
struct ConcreteTarget1 : Target1 {}
|
|
struct ConcreteTarget2 : Target2 {}
|
|
struct ConcreteTarget3 : Target3 {}
|
|
|
|
|
|
struct C {
|
|
func returnsConcreteTarget1() -> ConcreteTarget1 { fatalError() }
|
|
func returnsExistentialTarget1() -> Target1 { fatalError() }
|
|
}
|
|
|
|
protocol P {
|
|
func returnsConcreteTarget2() -> ConcreteTarget2
|
|
func returnsConcreteTarget3() -> ConcreteTarget3
|
|
}
|
|
|
|
extension P {
|
|
func returnSelf() -> Self { return self }
|
|
func returnsConcreteTarget2() -> ConcreteTarget2 { fatalError() }
|
|
func returnsConcreteTarget3() -> ConcreteTarget3 { fatalError() }
|
|
}
|
|
|
|
extension C : P {}
|
|
|
|
func testing(obj: C) {
|
|
let _ = obj #^TEST_1^#
|
|
let _ = obj .#^TEST_2^#
|
|
let _ = obj.returnSelf()#^TEST_3^#
|
|
let _ = obj.returnSelf().#^TEST_4^#
|
|
}
|
|
|
|
// CHECK_1: -----BEGIN CONFORMING METHOD LIST-----
|
|
// CHECK_1-NEXT: - TypeName: C
|
|
// CHECK_1-NEXT: - Members:
|
|
// CHECK_1-NEXT: - Name: returnsConcreteTarget1()
|
|
// CHECK_1-NEXT: TypeName: ConcreteTarget1
|
|
// CHECK_1-NEXT: - Name: returnsConcreteTarget2()
|
|
// CHECK_1-NEXT: TypeName: ConcreteTarget2
|
|
// CHECK_1-NEXT: -----END CONFORMING METHOD LIST-----
|