mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
1. Array type parsing for postfix array types Int[]. We now handle this in the parser, but remove the AST representation of this old form. We also stop making vague promises about the future by saying that "fixed size arrays aren't supported... yet". Removal of this fixes a compiler crasher too. 2. Remove the special case support for migrating @autoclosure from types to parameters, which was Swift 1.0/1.1 syntax. The world has moved or we don't care anymore. 3. Remove upgrade support for # arguments (nee "backtick" arguments), which was a Swift 1.x'ism abolished in an effort to simplify method naming rules. NFC on valid code.
111 lines
2.7 KiB
Swift
111 lines
2.7 KiB
Swift
struct A {}
|
|
struct B {}
|
|
|
|
func aaa() {}
|
|
func aaa(x: A) {}
|
|
func aaa(x: B) {}
|
|
func aaa(x: B, y: B) {}
|
|
func aaa(x x: B, y: B) {}
|
|
func aab() {}
|
|
|
|
func test001() {
|
|
#^TOP_LEVEL_0,aa^#
|
|
}
|
|
// RUN: %complete-test -group=overloads -tok=TOP_LEVEL_0 %s | FileCheck -check-prefix=TOP_LEVEL_0 %s
|
|
// TOP_LEVEL_0-LABEL: aaa:
|
|
// TOP_LEVEL_0-NEXT: aaa()
|
|
// TOP_LEVEL_0-NEXT: aaa(x: A)
|
|
// TOP_LEVEL_0-NEXT: aaa(x: B)
|
|
// TOP_LEVEL_0-NEXT: aaa(x: B, y: B)
|
|
// TOP_LEVEL_0-NEXT: aaa(x: B, y: B)
|
|
// TOP_LEVEL_0-NEXT: aab()
|
|
|
|
struct Foo {
|
|
func aaa() {}
|
|
func aaa(x: A) {}
|
|
func aaa(x: B) {}
|
|
func aaa(x: B, y: B) {}
|
|
func aaa(x x: B, y: B) {}
|
|
func aab() {}
|
|
}
|
|
|
|
func test002() {
|
|
Foo().#^FOO_INSTANCE_0^#
|
|
}
|
|
// RUN: %complete-test -group=overloads -tok=FOO_INSTANCE_0 %s | FileCheck -check-prefix=FOO_INSTANCE_0 %s
|
|
// FOO_INSTANCE_0-LABEL: aaa:
|
|
// FOO_INSTANCE_0-NEXT: aaa()
|
|
// FOO_INSTANCE_0-NEXT: aaa(x: A)
|
|
// FOO_INSTANCE_0-NEXT: aaa(x: B)
|
|
// FOO_INSTANCE_0-NEXT: aaa(x: B, y: B)
|
|
// FOO_INSTANCE_0-NEXT: aaa(x: B, y: B)
|
|
// FOO_INSTANCE_0-NEXT: aab()
|
|
|
|
|
|
extension Foo {
|
|
static func bbb() {}
|
|
static func bbb(x: A) {}
|
|
static func bbc() {}
|
|
}
|
|
|
|
func test003() {
|
|
Foo.#^FOO_QUAL_0^#
|
|
}
|
|
// RUN: %complete-test -group=overloads -tok=FOO_QUAL_0 %s | FileCheck -check-prefix=FOO_QUAL_0 %s
|
|
// FOO_QUAL_0-LABEL: bbb:
|
|
// FOO_QUAL_0-NEXT: bbb()
|
|
// FOO_QUAL_0-NEXT: bbb(x: A)
|
|
// FOO_QUAL_0-NEXT: bbc()
|
|
|
|
extension Foo {
|
|
subscript(x: A) -> A { return A() }
|
|
subscript(x: B) -> B { return B() }
|
|
}
|
|
|
|
func test004() {
|
|
Foo()#^FOO_SUBSCRIPT_0^#
|
|
}
|
|
// RUN: %complete-test -group=overloads -tok=FOO_SUBSCRIPT_0 %s | FileCheck -check-prefix=FOO_SUBSCRIPT_0 %s
|
|
// FOO_SUBSCRIPT_0-LABEL: [:
|
|
// FOO_SUBSCRIPT_0-NEXT: [A]
|
|
// FOO_SUBSCRIPT_0-NEXT: [B]
|
|
|
|
struct Bar {
|
|
init() {}
|
|
init(x: A) {}
|
|
init(x: B) {}
|
|
}
|
|
|
|
func test005() {
|
|
Bar#^BAR_INIT_0^#
|
|
}
|
|
// Inline a lonely group
|
|
// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_0 %s | FileCheck -check-prefix=BAR_INIT_0 %s
|
|
// BAR_INIT_0-NOT: (:
|
|
// BAR_INIT_0: ()
|
|
// BAR_INIT_0-NEXT: (x: A)
|
|
// BAR_INIT_0-NEXT: (x: B)
|
|
|
|
extension Bar {
|
|
func foo()
|
|
}
|
|
|
|
func test006() {
|
|
Bar#^BAR_INIT_1^#
|
|
}
|
|
// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_1 %s | FileCheck -check-prefix=BAR_INIT_1 %s
|
|
// BAR_INIT_1-LABEL: (:
|
|
// BAR_INIT_1-NEXT: ()
|
|
// BAR_INIT_1-NEXT: (x: A)
|
|
// BAR_INIT_1-NEXT: (x: B)
|
|
// BAR_INIT_1-NEXT: foo(self: Bar)
|
|
|
|
func test007() {
|
|
#^BAR_INIT_2^#
|
|
// RUN: %complete-test -add-inits-to-top-level -group=overloads -tok=BAR_INIT_2 %s | FileCheck -check-prefix=BAR_INIT_2 %s
|
|
// BAR_INIT_2-LABEL: Bar:
|
|
// BAR_INIT_2-NEXT: Bar
|
|
// BAR_INIT_2-NEXT: Bar()
|
|
// BAR_INIT_2-NEXT: Bar(x: A)
|
|
// BAR_INIT_2-NEXT: Bar(x: B)
|