Gardening: Migrate test suite to GH issues: IDE

This commit is contained in:
Anthony Latsis
2022-08-31 03:00:06 +03:00
parent 04f1cde82e
commit 8c1f391878
22 changed files with 96 additions and 65 deletions

View File

@@ -2,7 +2,7 @@
// RUN: %target-swift-ide-test -syntax-coloring -typecheck -source-filename %s | %FileCheck %s
// NOTE: Testing 'class' at the end of the file. Don't add anything after that.
// https://bugs.swift.org/browse/SR-8378
// https://github.com/apple/swift/issues/50905
// CHECK: <kw>protocol</kw> P : <type>class</type>
protocol P : class

View File

@@ -930,11 +930,13 @@ func testCompleteLabelAfterVararg() {
// COMPLETE_MEMBER_IN_VARARG: End completions
}
struct Sr14515 {
// https://github.com/apple/swift/issues/56867
struct S_56867 {
func test(_: Foo..., yArg: Baz) {}
}
private func testSr14515(value: Sr14515, foo: Foo, baz: Baz) {
private func test_56867(value: S_56867, foo: Foo, baz: Baz) {
value.test(foo, #^COMPLETE_VARARG_FOLLOWED_BY_NORMAL_ARG^#)
// COMPLETE_VARARG_FOLLOWED_BY_NORMAL_ARG: Begin completions
// COMPLETE_VARARG_FOLLOWED_BY_NORMAL_ARG-DAG: Decl[LocalVar]/Local/TypeRelation[Convertible]: foo[#Foo#];
@@ -995,15 +997,17 @@ struct Rdar77867723 {
}
}
struct SR14737<T> {
// https://github.com/apple/swift/issues/57087
struct S_57087<T> {
init(arg1: T, arg2: Bool) {}
}
extension SR14737 where T == Int {
extension S_57087 where T == Int {
init(arg1: T, onlyInt: Bool) {}
}
func test_SR14737() {
do {
invalidCallee {
SR14737(arg1: true, #^GENERIC_INIT_IN_INVALID^#)
S_57087(arg1: true, #^GENERIC_INIT_IN_INVALID^#)
// GENERIC_INIT_IN_INVALID: Begin completions, 1 item
// GENERIC_INIT_IN_INVALID-DAG: Pattern/Local/Flair[ArgLabels]: {#arg2: Bool#}[#Bool#];
// GENERIC_INIT_IN_INVALID: End completions

View File

@@ -88,7 +88,8 @@ func foo(s: MyStruct<Int>) {
// META_MYSTRUCT_INT_DOT: End completions
}
//https://bugs.swift.org/browse/SR-9938
// https://github.com/apple/swift/issues/52344
enum Fruit { case apple }
enum Vegetable { case broccoli }
enum Meat { case chicken }

View File

@@ -8,7 +8,9 @@ struct Foo<T> {
}
}
// SR-642 Code completion does not instantiate generic arguments of a type wrapped in an optional
// https://github.com/apple/swift/issues/43259
// Code completion does not instantiate generic arguments of a type wrapped
// in an optional
let x: Foo<Bar>? = Foo<Bar>()
x.#^FOO_OPTIONAL_1^#
// FOO_OPTIONAL_1: Begin completions, 7 items

View File

@@ -39,27 +39,30 @@ class C3 {
// INHERIT-NOT: ValueString2
// INHERIT-NOT: TopLevelFunc
// https://github.com/apple/swift/issues/56788
class Sr14432<T, U> {}
class C4<T, U> {}
_ = Sr14432<#^GENERIC_TYPE_PARAM^# >()
_ = Sr14432<SomeType, #^SECOND_GENERIC_TYPE_PARAM^# >()
_ = C4<#^GENERIC_TYPE_PARAM^# >()
_ = C4<SomeType, #^SECOND_GENERIC_TYPE_PARAM^# >()
// GENERIC_TYPE_PARAM: Begin completions
// GENERIC_TYPE_PARAM-DAG: Decl[Class]/CurrModule: C1[#C1#];
// GENERIC_TYPE_PARAM: End completions
struct Sr14627 {
// https://github.com/apple/swift/issues/56979
struct S2 {
struct Nested<Elements> {
init() { fatalError() }
init() {}
}
}
var sr14627_globalVar = Sr14627.Nested< #^GENERIC_PARAM_ON_NESTED_TYPE_GLOBAL_VAR^#>()
var s2_globalVar = S2.Nested< #^GENERIC_PARAM_ON_NESTED_TYPE_GLOBAL_VAR^#>()
func someFunction() {
var sr14627_localVar = Sr14627.Nested< #^GENERIC_PARAM_ON_NESTED_TYPE_LOCAL_VAR^#>()
var s2_localVar = S2.Nested< #^GENERIC_PARAM_ON_NESTED_TYPE_LOCAL_VAR^#>()
}
// GENERIC_PARAM_ON_NESTED_TYPE: Begin completions
// GENERIC_PARAM_ON_NESTED_TYPE-DAG: Decl[Struct]/CurrModule: Sr14627[#Sr14627#];
// GENERIC_PARAM_ON_NESTED_TYPE-DAG: Decl[Struct]/CurrModule: S2[#S2#];
// GENERIC_PARAM_ON_NESTED_TYPE: End completions

View File

@@ -9,9 +9,10 @@
import library
// https://github.com/apple/swift/issues/49889
// Ensure we maintain compatibility with Swift 4's overload signature rules.
// Variables defined in extensions of generic types had different overload
// signatures to other variables, so allow overloading in such cases (SR-7341).
// signatures to other variables, so allow overloading in such cases.
extension HasFooGeneric {
var foo: String { return "" } // foo isn't defined in a generic extension in the other module, so allow overloading in Swift 4 mode.
var bar: String { return "" } // bar is defined in a generic extension in the other module, so `bar: String` always shadows it.

View File

@@ -31,8 +31,8 @@
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_E_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_E_1
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUBCLASS | %FileCheck %s -check-prefix=SR627_SUBCLASS
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUB_SUBCLASS | %FileCheck %s -check-prefix=SR627_SUB_SUBCLASS
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ISSUE_43244_SUBCLASS | %FileCheck %s -check-prefix=ISSUE_43244_SUBCLASS
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ISSUE_43244_SUB_SUBCLASS | %FileCheck %s -check-prefix=ISSUE_43244_SUB_SUBCLASS
//===---
//===--- Test that we can code complete in methods, and correctly distinguish
@@ -598,22 +598,23 @@ func testOuterE() {
// NESTED_NOMINAL_DECL_E_1-NOT: dFunc6()
// NESTED_NOMINAL_DECL_E_1: End completions
class SR627_BaseClass<T> {
func myFunction(_ x: T) -> T? {
return nil
// https://github.com/apple/swift/issues/43244
do {
class BaseClass<T> {
func myFunction(_ x: T) -> T? {}
}
class Subclass: BaseClass<String> {
#^ISSUE_43244_SUBCLASS^#
// ISSUE_43244_SUBCLASS: Begin completions
// ISSUE_43244_SUBCLASS-DAG: Decl[InstanceMethod]/Super: override func myFunction(_ x: String) -> String? {|}; name=myFunction(:)
// ISSUE_43244_SUBCLASS: End completions
}
class SubSubclass: Subclass {
#^ISSUE_43244_SUB_SUBCLASS^#
// ISSUE_43244_SUB_SUBCLASS: Begin completions
// ISSUE_43244_SUB_SUBCLASS-DAG: Decl[InstanceMethod]/Super: override func myFunction(_ x: String) -> String? {|}; name=myFunction(:)
// ISSUE_43244_SUB_SUBCLASS: End completions
}
}
class SR627_Subclass: SR627_BaseClass<String> {
#^SR627_SUBCLASS^#
// SR627_SUBCLASS: Begin completions
// SR627_SUBCLASS-DAG: Decl[InstanceMethod]/Super: override func myFunction(_ x: String) -> String? {|}; name=myFunction(:)
// SR627_SUBCLASS: End completions
}
class SR627_SubSubclass: SR627_Subclass {
#^SR627_SUB_SUBCLASS^#
// SR627_SUB_SUBCLASS: Begin completions
// SR627_SUB_SUBCLASS-DAG: Decl[InstanceMethod]/Super: override func myFunction(_ x: String) -> String? {|}; name=myFunction(:)
// SR627_SUB_SUBCLASS: End completions
}

View File

@@ -50,11 +50,13 @@ func moduleScoped() {
// MODULE_SCOPED-NOT: ERROR
// MODULE_SCOPED: End completions
// https://github.com/apple/swift/issues/57800
enum Foo {
case bar
}
var sr15495: Void = {
var _: Void = {
let foo: Foo = .#^VAR_INITIALIZED_BY_CALLING_CLOSURE^#
}()

View File

@@ -205,7 +205,7 @@ func testFallbackPostfix() {
// doesn't match the already-provided parameters (missing `name` label argument
// and closure does not return `String`). However, we are not type-checking at
// the stage at which we complete argument labels, so we can't rule it out for
// now (SR-14450).
// now. (https://github.com/apple/swift/issues/56806)
// INIT_FALLBACK_1: Begin completions, 3 items
// INIT_FALLBACK_1-DAG: Pattern/Local/Flair[ArgLabels]: {#arg3: () -> _ {|}#}[#() -> _#]
// INIT_FALLBACK_1-DAG: Decl[InstanceMethod]/CurrNominal: .testStructMethod()[#Void#];

View File

@@ -387,16 +387,18 @@ class OmitKW10: ProtocolA {
// WITH_PA
}
protocol SR2560Proto {
// https://github.com/apple/swift/issues/45165
protocol P_45165 {
func foo<S : Sequence>(x: S) where S.Iterator.Element == Int
}
class SR2560Class: SR2560Proto {
#^SR2560_WHERE_CLAUSE?keywords=false^#
class C_45165: P_45165 {
#^ISSUE_45165_WHERE_CLAUSE?keywords=false^#
}
// SR2560_WHERE_CLAUSE: Begin completions
// SR2560_WHERE_CLAUSE: Decl[InstanceMethod]/Super: func foo<S>(x: S) where S : Sequence, S.Element == Int {|};
// SR2560_WHERE_CLAUSE: End completions
// ISSUE_45165_WHERE_CLAUSE: Begin completions
// ISSUE_45165_WHERE_CLAUSE: Decl[InstanceMethod]/Super: func foo<S>(x: S) where S : Sequence, S.Element == Int {|};
// ISSUE_45165_WHERE_CLAUSE: End completions
protocol HasThrowingProtocol {
func foo() throws
@@ -758,10 +760,11 @@ class SynthesizedConformance5: SynthesizedConformance2 {
// FIXME: 'required init(from decoder: Decoder)' is suggested twice
}
protocol ProtocolSr14687 {
// https://github.com/apple/swift/issues/57037
protocol P_57037 {
var value: Int { get }
}
struct StructSr14687: ProtocolSr14687 {
struct S_57037: P_57037 {
let foo = val, #^MULTI_VAR_DECL_OVERRIDE^#
// MULTI_VAR_DECL_OVERRIDE: Begin completions, 1 items
// MULTI_VAR_DECL_OVERRIDE-DAG: Decl[InstanceVar]/Super: value: Int;

View File

@@ -111,7 +111,7 @@ func testType() {
// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]/IsSystem: AssignmentPrecedence; name=AssignmentPrecedence
// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]/IsSystem: ComparisonPrecedence; name=ComparisonPrecedence
/* FIXME: SR-8898 We only see precedence groups that are earlier in life! */
/* FIXME: (https://github.com/apple/swift/issues/51404) We only see precedence groups that are earlier in life! */
// PRECEDENCE_GROUP_CURRFILE-DAG: Begin completions
// PRECEDENCE_GROUP_CURRFILE-DAG: Decl[PrecedenceGroup]/CurrModule: MyPrecedence{{[0-9]+}};
// PRECEDENCE_GROUP_CURRFILE-DAG: Decl[PrecedenceGroup]/CurrModule: MyPrecedence{{[0-9]+}};

View File

@@ -47,10 +47,12 @@ func test2<T: FontStyle>(x: T) {
// COMPLETE_ON_GENERIC_FUNC: End completions
}
struct Sr12973 {}
// https://github.com/apple/swift/issues/55419
struct Struct {}
struct Indicator<T> {}
extension Indicator where T == Sr12973 {
static var activity: Indicator<Sr12973> { fatalError() }
extension Indicator where T == Struct {
static var activity: Indicator<Struct> { fatalError() }
}
func receiver<T>(_ inidicator: Indicator<T>) {}
@@ -60,7 +62,7 @@ func test() {
}
// COMPLETE_GENERIC_TYPE: Begin completions, 2 items
// COMPLETE_GENERIC_TYPE: Decl[Constructor]/CurrNominal/TypeRelation[Convertible]: init()[#Indicator<T>#];
// COMPLETE_GENERIC_TYPE: Decl[StaticVar]/CurrNominal/TypeRelation[Convertible]: activity[#Indicator<Sr12973>#];
// COMPLETE_GENERIC_TYPE: Decl[StaticVar]/CurrNominal/TypeRelation[Convertible]: activity[#Indicator<Struct>#];
// COMPLETE_GENERIC_TYPE: End completions
func testRecursive<T>(_ inidicator: Indicator<T>) {

View File

@@ -2,7 +2,7 @@
// RUN: %swift-ide-test -code-completion -source-filename=%s -code-completion-token=B | %FileCheck %s --check-prefix=B
// RUN: %swift-ide-test -code-completion -source-filename=%s -code-completion-token=D | %FileCheck %s --check-prefix=D
// https://bugs.swift.org/browse/SR-13271
// https://github.com/apple/swift/issues/55711
// https://forums.swift.org/t/code-completion-enhancement-request/38677
enum AIdentifier {

View File

@@ -1,6 +1,8 @@
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERRIDE | %FileCheck %s --check-prefix=OVERRIDE
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER | %FileCheck %s --check-prefix=MEMBER
// https://github.com/apple/swift/issues/56012
class Root {
func onRoot() {}
}

View File

@@ -1,5 +1,7 @@
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
// https://github.com/apple/swift/issues/56810
struct Foo {
let bar: Bool
}

View File

@@ -1,5 +1,7 @@
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE | %FileCheck %s
// https://github.com/apple/swift/issues/56811
public enum Endpoint {
  case movieDetail

View File

@@ -1,5 +1,7 @@
// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=COMPLETE | %FileCheck %s
// https://github.com/apple/swift/issues/57061
struct TodaySectionEditView {
var sections: [SectionHeaderView2] = []
@ViewBuilder2 var body: some View2 {

View File

@@ -1,5 +1,7 @@
// RUN: %swift-ide-test -code-completion -code-completion-token COMPLETE -source-filename %s | %FileCheck %s
// https://github.com/apple/swift/issues/57263
struct Foo {
var bar: Int
}

View File

@@ -1,6 +1,6 @@
/// Check that serialized non user accessible functions are not autocompleted.
/// rdar://problem/53891642
/// SR-7460
/// https://github.com/apple/swift/issues/50003
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module %S/Inputs/complete_user_accessibility_helper.swift -module-name helper -emit-module-path %t/helper.swiftmodule

View File

@@ -169,7 +169,7 @@ typealias Typealias1 = FooNonExistentProtocol // expected-error {{cannot find ty
// NO-TYREPR: {{^}}typealias Typealias1 = <<error type>>{{$}}
// TYREPR: {{^}}typealias Typealias1 = FooNonExistentProtocol{{$}}
// sr-197
// https://github.com/apple/swift/issues/42819
func foo(bar: Typealias1<Int>) {} // Should not generate error "cannot specialize non-generic type '<<error type>>'"
// Associated types.

View File

@@ -149,9 +149,10 @@ func testDefer() {
}
}
// https://github.com/apple/swift/issues/55404
func testPropertyWrapper() {
@propertyWrapper
public struct SR12958 {
public struct Wrapper {
public var wrappedValue: String
init(_ wrappedValue: String) {
self.wrappedValue = wrappedValue
@@ -159,7 +160,7 @@ func testPropertyWrapper() {
}
public struct MyStruct {
@SR12958("something")
@Wrapper("something")
public static var somevar: String
public static var someothervar: Int
}
@@ -204,7 +205,7 @@ func testPropertyWrapper() {
// RUN: %target-swift-ide-test -range -pos=133:1 -end-pos=135:65 -source-filename %s | %FileCheck %s -check-prefix=CHECK-NO-PATTERN
// RUN: %target-swift-ide-test -range -pos=142:12 -end-pos=142:17 -source-filename %s | %FileCheck %s -check-prefix=CHECK-X-Y
// RUN: %target-swift-ide-test -range -pos=147:1 -end-pos=150:1 -source-filename %s | %FileCheck %s -check-prefix=CHECK-INVALID
// RUN: %target-swift-ide-test -range -pos=162:5 -end-pos=163:38 -source-filename %s | %FileCheck %s -check-prefix=CHECK-PROPERTY-WRAPPER
// RUN: %target-swift-ide-test -range -pos=163:5 -end-pos=164:38 -source-filename %s | %FileCheck %s -check-prefix=CHECK-PROPERTY-WRAPPER
// CHECK-NO-PATTERN: <Kind>MultiStatement</Kind>
@@ -504,7 +505,7 @@ func testPropertyWrapper() {
// CHECK-X-Y: <Referenced>y</Referenced><Type>Int</Type>
// CHECK-PROPERTY-WRAPPER: <Kind>SingleDecl</Kind>
// CHECK-PROPERTY-WRAPPER-NEXT: <Content>@SR12958("something")
// CHECK-PROPERTY-WRAPPER-NEXT: <Content>@Wrapper("something")
// CHECK-PROPERTY-WRAPPER-NEXT: public static var somevar: String</Content>
// CHECK-PROPERTY-WRAPPER-NEXT: <Context>swift_ide_test.(file).testPropertyWrapper().MyStruct</Context>
// CHECK-PROPERTY-WRAPPER-NEXT: <Declared>somevar</Declared><OutscopeReference>false</OutscopeReference>

View File

@@ -37,11 +37,12 @@ func testWithoutActuallyEscaping(closure: (Int) -> Void) {
}
}
class SR12957 {
static let main = SR12957()
}
// https://github.com/apple/swift/issues/55403
func bar(x: SR12957 = .main) {}
class C2 {
static let main = C2()
}
func bar(x: C2 = .main) {}
// RUN: %target-swift-ide-test -range -pos=7:8 -end-pos=7:19 -source-filename %s | %FileCheck %s -check-prefix=CHECK-BOOL
// CHECK-BOOL: <Type>Bool</Type>
@@ -61,7 +62,7 @@ func bar(x: SR12957 = .main) {}
// RUN: %target-swift-ide-test -range -pos=35:1 -end-pos=38:1 -source-filename %s | %FileCheck %s -check-prefix=CHECK-MTEE-EXPR-1
// RUN: %target-swift-ide-test -range -pos=35:27 -end-pos=35:34 -source-filename %s | %FileCheck %s -check-prefix=CHECK-MTEE-EXPR-2
// RUN: %target-swift-ide-test -range -pos=35:36 -end-pos=37:4 -source-filename %s | %FileCheck %s -check-prefix=CHECK-MTEE-EXPR-3
// RUN: %target-swift-ide-test -range -pos=44:23 -end-pos=44:28 -source-filename %s | %FileCheck %s -check-prefix=CHECK-DEFAULT-ARGUMENT
// RUN: %target-swift-ide-test -range -pos=45:18 -end-pos=45:23 -source-filename %s | %FileCheck %s -check-prefix=CHECK-DEFAULT-ARGUMENT
// CHECK-PART-EXPR: <Kind>PartOfExpression</Kind>
// CHECK-PART-EXPR-NEXT: <Content>getSelf()</Content>
@@ -117,7 +118,7 @@ func bar(x: SR12957 = .main) {}
// CHECK-DEFAULT-ARGUMENT: <Kind>SingleExpression</Kind>
// CHECK-DEFAULT-ARGUMENT-NEXT: <Content>.main</Content>
// CHECK-DEFAULT-ARGUMENT-NEXT: <Type>SR12957</Type><Exit>false</Exit>
// CHECK-DEFAULT-ARGUMENT-NEXT: <Type>C2</Type><Exit>false</Exit>
// CHECK-DEFAULT-ARGUMENT-NEXT: <Context>swift_ide_test.(file).bar(x:)</Context>
// CHECK-DEFAULT-ARGUMENT-NEXT: <ASTNodes>1</ASTNodes>
// CHECK-DEFAULT-ARGUMENT-NEXT: <end>