Skip to content

Commit 7eb4f0d

Browse files
committed
[ASTPrinter] Fix printing of nested typealias types and make it consistent with printing of nominal types.
This fixes several issues: - By default parent types of alias types are not printed which results in - Erroneous fixits, for example when casting to 'Notification.Name' from a string, which ends up adding erroneous cast as "Name(rawValue: ...)" - Hard to understand types in code-completion results and diagnostics - When printing with 'fully-qualified' option typealias types are printed erroneously like this "<PARENT>.Type.<TYPEALIAS>" The change make typealias printing same as nominal types and addresses the above.
1 parent 96e2a4c commit 7eb4f0d

26 files changed

+87
-66
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ struct PrintOptions {
314314

315315
/// \brief The module in which the printer is used. Determines if the module
316316
/// name should be printed when printing a type.
317-
ModuleDecl *CurrentModule;
317+
ModuleDecl *CurrentModule = nullptr;
318318

319319
/// \brief The information for converting archetypes to specialized types.
320320
std::shared_ptr<TypeTransformContext> TransformContext;

lib/AST/ASTPrinter.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,12 +3590,17 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
35903590
return;
35913591
}
35923592

3593-
if (shouldPrintFullyQualified(T)) {
3594-
if (auto ParentDC = T->getDecl()->getDeclContext()) {
3595-
printDeclContext(ParentDC);
3596-
Printer << ".";
3597-
}
3593+
auto ParentDC = T->getDecl()->getDeclContext();
3594+
auto ParentNominal = ParentDC ?
3595+
ParentDC->getAsNominalTypeOrNominalTypeExtensionContext() : nullptr;
3596+
3597+
if (ParentNominal) {
3598+
visit(ParentNominal->getDeclaredType());
3599+
Printer << ".";
3600+
} else if (shouldPrintFullyQualified(T)) {
3601+
printModuleContext(T);
35983602
}
3603+
35993604
printTypeDeclName(T);
36003605
}
36013606

test/ClangModules/enum-with-target.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let calendarUnitsDep: NSCalendarUnitDeprecated = [.eraCalendarUnitDeprecated, .y
1414
// rdar://problem/21081557
1515
func pokeRawValue(_ random: SomeRandomEnum) {
1616
switch (random) {
17-
case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}}
17+
case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'SomeRandomEnum.RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}}
1818
// expected-error@-1{{expected ':' after 'case'}}
1919
}
2020
}

test/Constraints/diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func rdar20142523() {
163163
// <rdar://problem/21080030> Bad diagnostic for invalid method call in boolean expression: (_, ExpressibleByIntegerLiteral)' is not convertible to 'ExpressibleByIntegerLiteral
164164
func rdar21080030() {
165165
var s = "Hello"
166-
if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'IndexDistance'}}{{24-26=}}
166+
if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'String.CharacterView.IndexDistance'}}{{24-26=}}
167167
}
168168

169169
// <rdar://problem/21248136> QoI: problem with return type inference mis-diagnosed as invalid arguments

test/Constraints/same_types.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ func test7<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y, T.Bar.Foo == X {
9191
func fail4<T: Barrable>(_ t: T) -> (Y, Z)
9292
where
9393
T.Bar == Y,
94-
T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Foo' (aka 'X') and 'Z'}}
94+
T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Y.Foo' (aka 'X') and 'Z'}}
9595
return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}}
9696
}
9797

9898
// TODO: repeat diagnostic
9999
func fail5<T: Barrable>(_ t: T) -> (Y, Z)
100100
where
101101
T.Bar.Foo == Z,
102-
T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Foo'}}
102+
T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Y.Foo'}}
103103
return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}}
104104
}
105105

test/FixCode/fixits-apply.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ func testMask13(a: MyEventMask2?) {
7878
testMask1(a: a) // no fix, nullability mismatch.
7979
}
8080

81+
struct Wrapper {
82+
typealias InnerMask = MyEventMask2
83+
}
84+
func sendItInner(_: Wrapper.InnerMask) {}
85+
func testInnerMask(a: UInt64) {
86+
sendItInner(a)
87+
}
88+
8189
struct SomeName : RawRepresentable {
8290
init(_ rawValue: String) {}
8391
init(rawValue: String) {}

test/FixCode/fixits-apply.swift.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ func testMask13(a: MyEventMask2?) {
7878
testMask1(a: a) // no fix, nullability mismatch.
7979
}
8080

81+
struct Wrapper {
82+
typealias InnerMask = MyEventMask2
83+
}
84+
func sendItInner(_: Wrapper.InnerMask) {}
85+
func testInnerMask(a: UInt64) {
86+
sendItInner(Wrapper.InnerMask(rawValue: a))
87+
}
88+
8189
struct SomeName : RawRepresentable {
8290
init(_ rawValue: String) {}
8391
init(rawValue: String) {}

test/Generics/generic_types.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct SequenceY : Sequence, IteratorProtocol {
162162

163163
func useRangeOfPrintables(_ roi : RangeOfPrintables<[Int]>) {
164164
var rop : RangeOfPrintables<X> // expected-error{{type 'X' does not conform to protocol 'Sequence'}}
165-
var rox : RangeOfPrintables<SequenceY> // expected-error{{type 'Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}}
165+
var rox : RangeOfPrintables<SequenceY> // expected-error{{type 'SequenceY.Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}}
166166
}
167167

168168
var dfail : Dictionary<Int> // expected-error{{generic type 'Dictionary' specialized with too few type parameters (got 1, but expected 2)}}
@@ -222,7 +222,7 @@ struct X4 : P, Q {
222222

223223
struct X5<T, U> where T: P, T: Q, T.AssocP == T.AssocQ { } // expected-note{{requirement specified as 'T.AssocP' == 'T.AssocQ' [with T = X4]}}
224224

225-
var y: X5<X4, Int> // expected-error{{'X5' requires the types 'AssocP' (aka 'Int') and 'AssocQ' (aka 'String') be equivalent}}
225+
var y: X5<X4, Int> // expected-error{{'X5' requires the types 'X4.AssocP' (aka 'Int') and 'X4.AssocQ' (aka 'String') be equivalent}}
226226

227227
// Recursive generic signature validation.
228228
class Top {}

test/Generics/superclass_constraint.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class S : P2 {
5757

5858
extension P2 where Self.T : C {
5959
// CHECK: superclass_constraint.(file).P2.concreteTypeWitnessViaSuperclass1
60-
// CHECK: Generic signature: <Self where Self : P2, Self.T : C, Self.T : P3, Self.T.T == T>
60+
// CHECK: Generic signature: <Self where Self : P2, Self.T : C, Self.T : P3, Self.T.T == C.T>
6161
// CHECK: Canonical generic signature: <τ_0_0 where τ_0_0 : P2, τ_0_0.T : C, τ_0_0.T : P3, τ_0_0.T.T == Int>
6262
func concreteTypeWitnessViaSuperclass1(x: Self.T.T) {}
6363
}
@@ -67,7 +67,7 @@ extension P2 where Self.T : C {
6767
// CHECK-NEXT: T witness marker
6868
// CHECK-NEXT: T : C [explicit @
6969
// CHECK-NEXT: T : P3 [redundant @
70-
// CHECK-NEXT: T[.P3].T == T [protocol]
70+
// CHECK-NEXT: T[.P3].T == C.T [protocol]
7171
// CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C>
7272
func superclassConformance1<T>(t: T) where T : C, T : P3 {}
7373

@@ -76,7 +76,7 @@ func superclassConformance1<T>(t: T) where T : C, T : P3 {}
7676
// CHECK-NEXT: T witness marker
7777
// CHECK-NEXT: T : C [explicit @
7878
// CHECK-NEXT: T : P3 [redundant @
79-
// CHECK-NEXT: T[.P3].T == T [protocol]
79+
// CHECK-NEXT: T[.P3].T == C.T [protocol]
8080
// CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C>
8181
func superclassConformance2<T>(t: T) where T : C, T : P3 {}
8282

test/IDE/complete_associated_types.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -267,35 +267,35 @@ func testBrokenConformances1() {
267267
StructWithBrokenConformance.#^BROKEN_CONFORMANCE_1^#
268268
}
269269
// BROKEN_CONFORMANCE_1: Begin completions, 34 items
270-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonA[#DefaultedTypeCommonA#]; name=DefaultedTypeCommonA
271-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonB[#DefaultedTypeCommonB#]; name=DefaultedTypeCommonB
272-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeB[#FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB
273-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonA[#DeducedTypeCommonA#]; name=DeducedTypeCommonA
274-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonB[#DeducedTypeCommonB#]; name=DeducedTypeCommonB
270+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonA[#StructWithBrokenConformance.DefaultedTypeCommonA#]; name=DefaultedTypeCommonA
271+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonB[#StructWithBrokenConformance.DefaultedTypeCommonB#]; name=DefaultedTypeCommonB
272+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeB[#StructWithBrokenConformance.FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB
273+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonA[#StructWithBrokenConformance.DeducedTypeCommonA#]; name=DeducedTypeCommonA
274+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonB[#StructWithBrokenConformance.DeducedTypeCommonB#]; name=DeducedTypeCommonB
275275
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}}
276276
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}}
277277
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Int#]{{; name=.+$}}
278-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDefaultedType[#FooDefaultedType#]; name=FooDefaultedType
279-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeB[#FooDeducedTypeB#]; name=FooDeducedTypeB
280-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeC[#FooDeducedTypeC#]; name=FooDeducedTypeC
281-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeD[#FooDeducedTypeD#]; name=FooDeducedTypeD
278+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDefaultedType[#StructWithBrokenConformance.FooDefaultedType#]; name=FooDefaultedType
279+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeB[#StructWithBrokenConformance.FooDeducedTypeB#]; name=FooDeducedTypeB
280+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeC[#StructWithBrokenConformance.FooDeducedTypeC#]; name=FooDeducedTypeC
281+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeD[#StructWithBrokenConformance.FooDeducedTypeD#]; name=FooDeducedTypeD
282282
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeB#]{{; name=.+$}}
283283
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeC#]{{; name=.+$}}
284284
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooD({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeD#]{{; name=.+$}}
285-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonC[#DefaultedTypeCommonC#]; name=DefaultedTypeCommonC
286-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonD[#DefaultedTypeCommonD#]; name=DefaultedTypeCommonD
287-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeA[#FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA
288-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeC[#FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC
289-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonC[#DeducedTypeCommonC#]; name=DeducedTypeCommonC
290-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonD[#DeducedTypeCommonD#]; name=DeducedTypeCommonD
285+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonC[#StructWithBrokenConformance.DefaultedTypeCommonC#]; name=DefaultedTypeCommonC
286+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonD[#StructWithBrokenConformance.DefaultedTypeCommonD#]; name=DefaultedTypeCommonD
287+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeA[#StructWithBrokenConformance.FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA
288+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeC[#StructWithBrokenConformance.FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC
289+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonC[#StructWithBrokenConformance.DeducedTypeCommonC#]; name=DeducedTypeCommonC
290+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonD[#StructWithBrokenConformance.DeducedTypeCommonD#]; name=DeducedTypeCommonD
291291
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}}
292292
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}}
293293
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonC({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonC#]{{; name=.+$}}
294294
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonD({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonD#]{{; name=.+$}}
295-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeA[#FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA
296-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeB[#FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB
297-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeC[#FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC
298-
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeD[#FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD
295+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeA[#StructWithBrokenConformance.FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA
296+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeB[#StructWithBrokenConformance.FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB
297+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeC[#StructWithBrokenConformance.FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC
298+
// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeD[#StructWithBrokenConformance.FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD
299299
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseA({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeA#]{{; name=.+$}}
300300
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeB#]{{; name=.+$}}
301301
// BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeC#]{{; name=.+$}}

test/IDE/complete_crashes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ while true {
6060
struct CustomGenericCollection<Key> : ExpressibleByDictionaryLiteral {
6161
// GENERIC_PARAM_AND_ASSOC_TYPE: Begin completions
6262
// GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count
63-
// GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Key[#Key#]; name=Key
64-
// GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Value[#Value#]; name=Value
63+
// GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[GenericTypeParam]/CurrNominal: Key[#Key#]; name=Key
64+
// GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Value[#CustomGenericCollection.Value#]; name=Value
6565
// GENERIC_PARAM_AND_ASSOC_TYPE: End completions
6666

6767
var count: Int { #^GENERIC_PARAM_AND_ASSOC_TYPE^# }

test/IDE/complete_from_foundation_overlay.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ func privateNominalMembers(a: String) {
2828

2929
// FIXME: we should show the qualified String.Index type.
3030
// rdar://problem/20788802
31-
// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}}
31+
// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}}
3232
// PRIVATE_NOMINAL_MEMBERS_1: End completions

test/IDE/complete_from_stdlib.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func privateNominalMembers(_ a: String) {
8383

8484
// FIXME: we should show the qualified String.Index type.
8585
// rdar://problem/20788802
86-
// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}}
86+
// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}}
8787
// PRIVATE_NOMINAL_MEMBERS_1: End completions
8888

8989
func protocolExtCollection1a<C : Collection>(_ a: C) {

test/IDE/complete_literal.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242

4343
// FIXME: we should show the qualified String.Index type.
4444
// rdar://problem/20788802
45-
// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]; name=startIndex{{$}}
46-
// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#Index#]; name=endIndex{{$}}
45+
// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]; name=startIndex{{$}}
46+
// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]; name=endIndex{{$}}
4747
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#(c): Character#})[#Void#]; name=append(c: Character){{$}}
4848
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#contentsOf: S#})[#Void#]; name=append(contentsOf: S){{$}}
49-
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: insert({#contentsOf: S#}, {#at: Index#})[#Void#]; name=insert(contentsOf: S, at: Index){{$}}
50-
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: remove({#at: Index#})[#Character#]; name=remove(at: Index){{$}}
49+
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: insert({#contentsOf: S#}, {#at: String.Index#})[#Void#]; name=insert(contentsOf: S, at: String.Index){{$}}
50+
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: remove({#at: String.Index#})[#Character#]; name=remove(at: String.Index){{$}}
5151
// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: lowercased()[#String#]; name=lowercased(){{$}}
5252

5353
func giveMeAString() -> Int {
@@ -56,7 +56,7 @@ func giveMeAString() -> Int {
5656
}
5757

5858
// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]{{; name=.+$}}
59-
// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#Index#]{{; name=.+$}}
59+
// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]{{; name=.+$}}
6060
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}}
6161
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}}
6262
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#contentsOf: S#})[#Void#]{{; name=.+$}}

test/IDE/print_ast_tc_decls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ struct d0200_EscapedIdentifiers {
608608

609609
func `func`<`let`: `protocol`, `where`>(
610610
class: Int, struct: `protocol`, foo: `let`, bar: `where`) where `where` : `protocol` {}
611-
// PASS_COMMON-NEXT: {{^}} func `func`<`let` : `protocol`, `where` where `where` : `protocol`>(class: Int, struct: `protocol`, foo: `let`, bar: `where`){{$}}
611+
// PASS_COMMON-NEXT: {{^}} func `func`<`let` : {{(d0200_EscapedIdentifiers.)?}}`protocol`, `where` where `where` : {{(d0200_EscapedIdentifiers.)?}}`protocol`>(class: Int, struct: {{(d0200_EscapedIdentifiers.)?}}`protocol`, foo: `let`, bar: `where`){{$}}
612612

613613
var `var`: `struct` = `struct`()
614614
// PASS_COMMON-NEXT: {{^}} var `var`: {{(d0200_EscapedIdentifiers.)?}}`struct`{{$}}

0 commit comments

Comments
 (0)