mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IDE/CodeCompletion] Teach code completion to display the local parameter name
if there's no parameter API name. This is for display purposes only.
Update all relevant tests accordingly.
This addresses <rdar://problem/16768768>.
For example:
class X {
func f(a: Int, b: Int) { }
}
Would previously display like this in code completion in Xcode:
f(<#Int#>, b: <#Int#>)
The local parameter name, while not API, often still conveys meaning
to the user. So it's now included like this:
f(<#a: Int#>, b: <#Int#>)
Swift SVN r18403
This commit is contained in:
@@ -68,10 +68,10 @@ func testSwiftCompletions(foo: SwiftStruct) {
|
||||
// CLANG_FOO-DAG: Decl[Struct]/OtherModule: FooStructTypedef2[#FooStructTypedef2#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[TypeAlias]/OtherModule: FooTypedef1[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[GlobalVar]/OtherModule: fooIntVar[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFunc1AnonymousParam({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFunc3({#CInt#}, {#CFloat#}, {#CDouble#}, {#CMutablePointer<CInt>#})[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFuncWithBlock({#((CFloat) -> CInt)?#})[#Void#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFunc3({#(a): CInt#}, {#(b): CFloat#}, {#(c): CDouble#}, {#(d): CMutablePointer<CInt>#})[#CInt#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFuncWithBlock({#(blk): ((CFloat) -> CInt)?#})[#Void#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFuncWithComment1()[#Void#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFuncWithComment2()[#Void#]{{$}}
|
||||
// CLANG_FOO-DAG: Decl[FreeFunction]/OtherModule: fooFuncWithComment3()[#Void#]{{$}}
|
||||
@@ -92,7 +92,7 @@ func testSwiftCompletions(foo: SwiftStruct) {
|
||||
// CLANG_FOO: End completions
|
||||
|
||||
// CLANG_FOO_SUB: Begin completions
|
||||
// CLANG_FOO_SUB-DAG: Decl[FreeFunction]/OtherModule: fooSubFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_SUB-DAG: Decl[FreeFunction]/OtherModule: fooSubFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_SUB-DAG: Decl[Struct]/OtherModule: FooSubEnum1[#FooSubEnum1#]{{$}}
|
||||
// CLANG_FOO_SUB-DAG: Decl[GlobalVar]/OtherModule: FooSubEnum1X[#FooSubEnum1#]{{$}}
|
||||
// CLANG_FOO_SUB-DAG: Decl[GlobalVar]/OtherModule: FooSubEnum1Y[#FooSubEnum1#]{{$}}
|
||||
@@ -100,13 +100,13 @@ func testSwiftCompletions(foo: SwiftStruct) {
|
||||
// CLANG_FOO_SUB: End completions
|
||||
|
||||
// CLANG_FOO_HELPER: Begin completions
|
||||
// CLANG_FOO_HELPER-DAG: Decl[FreeFunction]/OtherModule: fooHelperFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_HELPER-DAG: Decl[FreeFunction]/OtherModule: fooHelperFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_HELPER-DAG: Decl[GlobalVar]/OtherModule: FooHelperUnnamedEnumeratorA1[#Int#]{{$}}
|
||||
// CLANG_FOO_HELPER-DAG: Decl[GlobalVar]/OtherModule: FooHelperUnnamedEnumeratorA2[#Int#]{{$}}
|
||||
// CLANG_FOO_HELPER: End completions
|
||||
|
||||
// CLANG_FOO_HELPER_SUB: Begin completions
|
||||
// CLANG_FOO_HELPER_SUB-DAG: Decl[FreeFunction]/OtherModule: fooHelperSubFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_HELPER_SUB-DAG: Decl[FreeFunction]/OtherModule: fooHelperSubFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_FOO_HELPER_SUB-DAG: Decl[Struct]/OtherModule: FooHelperSubEnum1[#FooHelperSubEnum1#]{{$}}
|
||||
// CLANG_FOO_HELPER_SUB-DAG: Decl[GlobalVar]/OtherModule: FooHelperSubEnum1X[#FooHelperSubEnum1#]{{$}}
|
||||
// CLANG_FOO_HELPER_SUB-DAG: Decl[GlobalVar]/OtherModule: FooHelperSubEnum1Y[#FooHelperSubEnum1#]{{$}}
|
||||
@@ -114,7 +114,7 @@ func testSwiftCompletions(foo: SwiftStruct) {
|
||||
// CLANG_FOO_HELPER_SUB: End completions
|
||||
|
||||
// CLANG_BAR: Begin completions
|
||||
// CLANG_BAR-DAG: Decl[FreeFunction]/OtherModule: barFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_BAR-DAG: Decl[FreeFunction]/OtherModule: barFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_BAR-DAG: Decl[Class]/OtherModule: BarForwardDeclaredClass[#BarForwardDeclaredClass#]{{$}}
|
||||
// CLANG_BAR-DAG: Decl[Struct]/OtherModule: BarForwardDeclaredEnum[#BarForwardDeclaredEnum#]{{$}}
|
||||
// CLANG_BAR-DAG: Decl[GlobalVar]/OtherModule: BarForwardDeclaredEnumValue[#BarForwardDeclaredEnum#]{{$}}
|
||||
@@ -124,7 +124,7 @@ func testSwiftCompletions(foo: SwiftStruct) {
|
||||
// CLANG_BAR: End completions
|
||||
|
||||
// CLANG_BOTH_FOO_BAR: Begin completions
|
||||
// CLANG_BOTH_FOO_BAR-DAG: Decl[FreeFunction]/OtherModule: redeclaredInMultipleModulesFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_BOTH_FOO_BAR-DAG: Decl[FreeFunction]/OtherModule: redeclaredInMultipleModulesFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_BOTH_FOO_BAR: End completions
|
||||
|
||||
// CLANG_QUAL_FOO_NEGATIVE-NOT: bar
|
||||
@@ -154,21 +154,21 @@ func testCompleteModuleQualifiedFoo2() {
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[Struct]/OtherModule: ._InternalStruct[#_InternalStruct#]
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: ._internalTopLevelFunc()[#Void#]
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[Enum]/OtherModule: .FooComparisonResult[#FooComparisonResult#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFunc1AnonymousParam({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFunc3({#CInt#}, {#CFloat#}, {#CDouble#}, {#CMutablePointer<CInt>#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFunc3({#(a): CInt#}, {#(b): CFloat#}, {#(c): CDouble#}, {#(d): CMutablePointer<CInt>#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncNoreturn1()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncNoreturn2()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithBlock({#((CFloat) -> CInt)?#})[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithBlock({#(blk): ((CFloat) -> CInt)?#})[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithComment1()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithComment2()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithComment3()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithComment4()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooFuncWithComment5()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooHelperFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooHelperSubFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooSubFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .redeclaredInMultipleModulesFunc1({#CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooHelperFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooHelperSubFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .fooSubFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .redeclaredInMultipleModulesFunc1({#(a): CInt#})[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule: .theLastDeclInFoo()[#Void#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[GlobalVar]/OtherModule: .FOO_MACRO_1[#CInt#]{{$}}
|
||||
// CLANG_QUAL_FOO_2-DAG: Decl[GlobalVar]/OtherModule: .FOO_MACRO_2[#CInt#]{{$}}
|
||||
@@ -242,7 +242,7 @@ func testCompleteClassMembers1() {
|
||||
// CLANG_CLASS_MEMBERS_1: Begin completions
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFunc0()[#Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFunc0({#self: FooClassBase#})[#() -> Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFunc1({#AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFunc1({#(anObject): AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFunc1({#self: FooClassBase#})[#(AnyObject!) -> FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[Constructor]/CurrNominal: ()[#FooClassBase#]
|
||||
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFuncOverridden()[#Void#]{{$}}
|
||||
@@ -275,7 +275,7 @@ func testCompleteClassMembers2() {
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/CurrNominal: .fooProtoClassFunc()[#Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/Super: .fooBaseInstanceFunc0()[#Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/Super: .fooBaseInstanceFunc0({#self: FooClassBase#})[#() -> Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/Super: .fooBaseInstanceFunc1({#AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/Super: .fooBaseInstanceFunc1({#(anObject): AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/Super: .fooBaseInstanceFunc1({#self: FooClassBase#})[#(AnyObject!) -> FooClassBase!#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/Super: .fooBaseInstanceFuncOverridden()[#Void#]{{$}}
|
||||
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/Super: .fooBaseClassFunc0()[#Void#]{{$}}
|
||||
@@ -297,14 +297,14 @@ func testCompleteInstanceMembers1(fooObject: FooClassDerived) {
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceVar]/CurrNominal: .fooProperty2[#CInt#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceVar]/CurrNominal: .fooProperty3[#CInt#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooInstanceFunc0()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooInstanceFunc1({#CInt#})[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooInstanceFunc2({#CInt#}, {#withB: CInt#})[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooInstanceFunc1({#(a): CInt#})[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooInstanceFunc2({#(a): CInt#}, {#withB: CInt#})[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFuncOverridden()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFunc()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFuncWithExtraIndentation1()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFuncWithExtraIndentation2()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: .fooBaseInstanceFunc0()[#Void#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: .fooBaseInstanceFunc1({#AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: .fooBaseInstanceFunc1({#(anObject): AnyObject?#})[#FooClassBase!#]{{$}}
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: ._internalMeth3()[#AnyObject!#]
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: ._internalMeth2()[#AnyObject!#]
|
||||
// CLANG_INSTANCE_MEMBERS_1-NEXT: Decl[InstanceMethod]/Super: .nonInternalMeth()[#AnyObject!#]
|
||||
|
||||
Reference in New Issue
Block a user