diff --git a/include/swift/AST/PrintOptions.h b/include/swift/AST/PrintOptions.h index c1e74e2ba4a..93da01e735a 100644 --- a/include/swift/AST/PrintOptions.h +++ b/include/swift/AST/PrintOptions.h @@ -314,7 +314,7 @@ struct PrintOptions { /// \brief The module in which the printer is used. Determines if the module /// name should be printed when printing a type. - ModuleDecl *CurrentModule; + ModuleDecl *CurrentModule = nullptr; /// \brief The information for converting archetypes to specialized types. std::shared_ptr TransformContext; diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index c434acc1b2b..48f095d2017 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -3590,12 +3590,24 @@ public: return; } - if (shouldPrintFullyQualified(T)) { - if (auto ParentDC = T->getDecl()->getDeclContext()) { - printDeclContext(ParentDC); - Printer << "."; + auto ParentDC = T->getDecl()->getDeclContext(); + auto ParentNominal = ParentDC ? + ParentDC->getAsNominalTypeOrNominalTypeExtensionContext() : nullptr; + + if (ParentNominal) { + Type ParentTy = ParentNominal->getType(); + if (auto *MT = ParentTy->getAs()) { + // Don't print as '.Type'. + // FIXME: There should be a convenient API to get a TypeDecl as a type + // without the meta type. + ParentTy = Type(MT->getInstanceType()); } + visit(ParentTy); + Printer << "."; + } else if (shouldPrintFullyQualified(T)) { + printModuleContext(T); } + printTypeDeclName(T); } diff --git a/test/ClangModules/enum-with-target.swift b/test/ClangModules/enum-with-target.swift index 15ce96c40e1..f83d86be28d 100644 --- a/test/ClangModules/enum-with-target.swift +++ b/test/ClangModules/enum-with-target.swift @@ -14,7 +14,7 @@ let calendarUnitsDep: NSCalendarUnitDeprecated = [.eraCalendarUnitDeprecated, .y // rdar://problem/21081557 func pokeRawValue(_ random: SomeRandomEnum) { switch (random) { - case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}} + case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'SomeRandomEnum.RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}} // expected-error@-1{{expected ':' after 'case'}} } } diff --git a/test/Constraints/diagnostics.swift b/test/Constraints/diagnostics.swift index beaa53319e3..809a5a9c960 100644 --- a/test/Constraints/diagnostics.swift +++ b/test/Constraints/diagnostics.swift @@ -163,7 +163,7 @@ func rdar20142523() { // Bad diagnostic for invalid method call in boolean expression: (_, ExpressibleByIntegerLiteral)' is not convertible to 'ExpressibleByIntegerLiteral func rdar21080030() { var s = "Hello" - if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'IndexDistance'}}{{24-26=}} + if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'String.CharacterView.IndexDistance'}}{{24-26=}} } // QoI: problem with return type inference mis-diagnosed as invalid arguments diff --git a/test/Constraints/same_types.swift b/test/Constraints/same_types.swift index 8ea59dbecda..cdc64135561 100644 --- a/test/Constraints/same_types.swift +++ b/test/Constraints/same_types.swift @@ -91,7 +91,7 @@ func test7(_ t: T) -> (Y, X) where T.Bar == Y, T.Bar.Foo == X { func fail4(_ t: T) -> (Y, Z) where T.Bar == Y, - T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Foo' (aka 'X') and 'Z'}} + T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Y.Foo' (aka 'X') and 'Z'}} return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}} } @@ -99,7 +99,7 @@ func fail4(_ t: T) -> (Y, Z) func fail5(_ t: T) -> (Y, Z) where T.Bar.Foo == Z, - T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Foo'}} + T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Y.Foo'}} return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}} } diff --git a/test/FixCode/fixits-apply.swift b/test/FixCode/fixits-apply.swift index 3fe4eb70fcb..937c661e95c 100644 --- a/test/FixCode/fixits-apply.swift +++ b/test/FixCode/fixits-apply.swift @@ -78,6 +78,14 @@ func testMask13(a: MyEventMask2?) { testMask1(a: a) // no fix, nullability mismatch. } +struct Wrapper { + typealias InnerMask = MyEventMask2 +} +func sendItInner(_: Wrapper.InnerMask) {} +func testInnerMask(a: UInt64) { + sendItInner(a) +} + struct SomeName : RawRepresentable { init(_ rawValue: String) {} init(rawValue: String) {} diff --git a/test/FixCode/fixits-apply.swift.result b/test/FixCode/fixits-apply.swift.result index a443dd71465..9256288e926 100644 --- a/test/FixCode/fixits-apply.swift.result +++ b/test/FixCode/fixits-apply.swift.result @@ -78,6 +78,14 @@ func testMask13(a: MyEventMask2?) { testMask1(a: a) // no fix, nullability mismatch. } +struct Wrapper { + typealias InnerMask = MyEventMask2 +} +func sendItInner(_: Wrapper.InnerMask) {} +func testInnerMask(a: UInt64) { + sendItInner(Wrapper.InnerMask(rawValue: a)) +} + struct SomeName : RawRepresentable { init(_ rawValue: String) {} init(rawValue: String) {} diff --git a/test/Generics/generic_types.swift b/test/Generics/generic_types.swift index 712024fd7d8..bb8ca96bd58 100644 --- a/test/Generics/generic_types.swift +++ b/test/Generics/generic_types.swift @@ -162,7 +162,7 @@ struct SequenceY : Sequence, IteratorProtocol { func useRangeOfPrintables(_ roi : RangeOfPrintables<[Int]>) { var rop : RangeOfPrintables // expected-error{{type 'X' does not conform to protocol 'Sequence'}} - var rox : RangeOfPrintables // expected-error{{type 'Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}} + var rox : RangeOfPrintables // expected-error{{type 'SequenceY.Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}} } var dfail : Dictionary // expected-error{{generic type 'Dictionary' specialized with too few type parameters (got 1, but expected 2)}} @@ -222,7 +222,7 @@ struct X4 : P, Q { struct X5 where T: P, T: Q, T.AssocP == T.AssocQ { } // expected-note{{requirement specified as 'T.AssocP' == 'T.AssocQ' [with T = X4]}} -var y: X5 // expected-error{{'X5' requires the types 'AssocP' (aka 'Int') and 'AssocQ' (aka 'String') be equivalent}} +var y: X5 // expected-error{{'X5' requires the types 'X4.AssocP' (aka 'Int') and 'X4.AssocQ' (aka 'String') be equivalent}} // Recursive generic signature validation. class Top {} diff --git a/test/Generics/superclass_constraint.swift b/test/Generics/superclass_constraint.swift index e513f06f976..6e5a18fa65a 100644 --- a/test/Generics/superclass_constraint.swift +++ b/test/Generics/superclass_constraint.swift @@ -57,7 +57,7 @@ class S : P2 { extension P2 where Self.T : C { // CHECK: superclass_constraint.(file).P2.concreteTypeWitnessViaSuperclass1 - // CHECK: Generic signature: + // CHECK: Generic signature: // CHECK: Canonical generic signature: <τ_0_0 where τ_0_0 : P2, τ_0_0.T : C, τ_0_0.T : P3, τ_0_0.T.T == Int> func concreteTypeWitnessViaSuperclass1(x: Self.T.T) {} } @@ -67,7 +67,7 @@ extension P2 where Self.T : C { // CHECK-NEXT: T witness marker // CHECK-NEXT: T : C [explicit @ // CHECK-NEXT: T : P3 [redundant @ -// CHECK-NEXT: T[.P3].T == T [protocol] +// CHECK-NEXT: T[.P3].T == C.T [protocol] // CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C> func superclassConformance1(t: T) where T : C, T : P3 {} @@ -76,7 +76,7 @@ func superclassConformance1(t: T) where T : C, T : P3 {} // CHECK-NEXT: T witness marker // CHECK-NEXT: T : C [explicit @ // CHECK-NEXT: T : P3 [redundant @ -// CHECK-NEXT: T[.P3].T == T [protocol] +// CHECK-NEXT: T[.P3].T == C.T [protocol] // CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C> func superclassConformance2(t: T) where T : C, T : P3 {} diff --git a/test/IDE/complete_associated_types.swift b/test/IDE/complete_associated_types.swift index 597b08df0d1..4b05781d499 100644 --- a/test/IDE/complete_associated_types.swift +++ b/test/IDE/complete_associated_types.swift @@ -267,35 +267,35 @@ func testBrokenConformances1() { StructWithBrokenConformance.#^BROKEN_CONFORMANCE_1^# } // BROKEN_CONFORMANCE_1: Begin completions, 34 items -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonA[#DefaultedTypeCommonA#]; name=DefaultedTypeCommonA -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonB[#DefaultedTypeCommonB#]; name=DefaultedTypeCommonB -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeB[#FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonA[#DeducedTypeCommonA#]; name=DeducedTypeCommonA -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonB[#DeducedTypeCommonB#]; name=DeducedTypeCommonB +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonA[#StructWithBrokenConformance.DefaultedTypeCommonA#]; name=DefaultedTypeCommonA +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonB[#StructWithBrokenConformance.DefaultedTypeCommonB#]; name=DefaultedTypeCommonB +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeB[#StructWithBrokenConformance.FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonA[#StructWithBrokenConformance.DeducedTypeCommonA#]; name=DeducedTypeCommonA +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonB[#StructWithBrokenConformance.DeducedTypeCommonB#]; name=DeducedTypeCommonB // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Int#]{{; name=.+$}} -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDefaultedType[#FooDefaultedType#]; name=FooDefaultedType -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeB[#FooDeducedTypeB#]; name=FooDeducedTypeB -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeC[#FooDeducedTypeC#]; name=FooDeducedTypeC -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeD[#FooDeducedTypeD#]; name=FooDeducedTypeD +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDefaultedType[#StructWithBrokenConformance.FooDefaultedType#]; name=FooDefaultedType +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeB[#StructWithBrokenConformance.FooDeducedTypeB#]; name=FooDeducedTypeB +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeC[#StructWithBrokenConformance.FooDeducedTypeC#]; name=FooDeducedTypeC +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooDeducedTypeD[#StructWithBrokenConformance.FooDeducedTypeD#]; name=FooDeducedTypeD // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeB#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeC#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooD({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeD#]{{; name=.+$}} -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonC[#DefaultedTypeCommonC#]; name=DefaultedTypeCommonC -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonD[#DefaultedTypeCommonD#]; name=DefaultedTypeCommonD -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeA[#FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeC[#FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonC[#DeducedTypeCommonC#]; name=DeducedTypeCommonC -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonD[#DeducedTypeCommonD#]; name=DeducedTypeCommonD +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonC[#StructWithBrokenConformance.DefaultedTypeCommonC#]; name=DefaultedTypeCommonC +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DefaultedTypeCommonD[#StructWithBrokenConformance.DefaultedTypeCommonD#]; name=DefaultedTypeCommonD +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeA[#StructWithBrokenConformance.FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDefaultedTypeC[#StructWithBrokenConformance.FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonC[#StructWithBrokenConformance.DeducedTypeCommonC#]; name=DeducedTypeCommonC +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: DeducedTypeCommonD[#StructWithBrokenConformance.DeducedTypeCommonD#]; name=DeducedTypeCommonD // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonC({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonC#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceCommonD({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonD#]{{; name=.+$}} -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeA[#FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeB[#FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeC[#FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC -// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeD[#FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeA[#StructWithBrokenConformance.FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeB[#StructWithBrokenConformance.FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeC[#StructWithBrokenConformance.FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC +// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal: FooBaseDeducedTypeD[#StructWithBrokenConformance.FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseA({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeA#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeB#]{{; name=.+$}} // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super: deduceFooBaseC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeC#]{{; name=.+$}} diff --git a/test/IDE/complete_crashes.swift b/test/IDE/complete_crashes.swift index 8ea8b2ec4ef..801dea4cc93 100644 --- a/test/IDE/complete_crashes.swift +++ b/test/IDE/complete_crashes.swift @@ -60,8 +60,8 @@ while true { struct CustomGenericCollection : ExpressibleByDictionaryLiteral { // GENERIC_PARAM_AND_ASSOC_TYPE: Begin completions // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count - // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Key[#Key#]; name=Key - // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Value[#Value#]; name=Value + // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[GenericTypeParam]/CurrNominal: Key[#Key#]; name=Key + // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal: Value[#CustomGenericCollection.Value#]; name=Value // GENERIC_PARAM_AND_ASSOC_TYPE: End completions var count: Int { #^GENERIC_PARAM_AND_ASSOC_TYPE^# } diff --git a/test/IDE/complete_from_foundation_overlay.swift b/test/IDE/complete_from_foundation_overlay.swift index efa967d6fc9..71bc169f259 100644 --- a/test/IDE/complete_from_foundation_overlay.swift +++ b/test/IDE/complete_from_foundation_overlay.swift @@ -28,5 +28,5 @@ func privateNominalMembers(a: String) { // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}} +// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}} // PRIVATE_NOMINAL_MEMBERS_1: End completions diff --git a/test/IDE/complete_from_stdlib.swift b/test/IDE/complete_from_stdlib.swift index e79e39d3cbc..44b29655154 100644 --- a/test/IDE/complete_from_stdlib.swift +++ b/test/IDE/complete_from_stdlib.swift @@ -83,7 +83,7 @@ func privateNominalMembers(_ a: String) { // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}} +// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}} // PRIVATE_NOMINAL_MEMBERS_1: End completions func protocolExtCollection1a(_ a: C) { diff --git a/test/IDE/complete_literal.swift b/test/IDE/complete_literal.swift index c31b7543d11..bfe4776a399 100644 --- a/test/IDE/complete_literal.swift +++ b/test/IDE/complete_literal.swift @@ -42,12 +42,12 @@ // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]; name=startIndex{{$}} -// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#Index#]; name=endIndex{{$}} +// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]; name=startIndex{{$}} +// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]; name=endIndex{{$}} // LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#(c): Character#})[#Void#]; name=append(c: Character){{$}} // LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#contentsOf: S#})[#Void#]; name=append(contentsOf: S){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: insert({#contentsOf: S#}, {#at: Index#})[#Void#]; name=insert(contentsOf: S, at: Index){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: remove({#at: Index#})[#Character#]; name=remove(at: Index){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: insert({#contentsOf: S#}, {#at: String.Index#})[#Void#]; name=insert(contentsOf: S, at: String.Index){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: remove({#at: String.Index#})[#Character#]; name=remove(at: String.Index){{$}} // LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: lowercased()[#String#]; name=lowercased(){{$}} func giveMeAString() -> Int { @@ -56,7 +56,7 @@ func giveMeAString() -> Int { } // LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]{{; name=.+$}} -// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#Index#]{{; name=.+$}} +// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]{{; name=.+$}} // LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}} // LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}} // LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#contentsOf: S#})[#Void#]{{; name=.+$}} diff --git a/test/IDE/print_ast_tc_decls.swift b/test/IDE/print_ast_tc_decls.swift index 304850019b7..bcb94055f2c 100644 --- a/test/IDE/print_ast_tc_decls.swift +++ b/test/IDE/print_ast_tc_decls.swift @@ -608,7 +608,7 @@ struct d0200_EscapedIdentifiers { func `func`<`let`: `protocol`, `where`>( class: Int, struct: `protocol`, foo: `let`, bar: `where`) where `where` : `protocol` {} -// PASS_COMMON-NEXT: {{^}} func `func`<`let` : `protocol`, `where` where `where` : `protocol`>(class: Int, struct: `protocol`, foo: `let`, bar: `where`){{$}} +// 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`){{$}} var `var`: `struct` = `struct`() // PASS_COMMON-NEXT: {{^}} var `var`: {{(d0200_EscapedIdentifiers.)?}}`struct`{{$}} diff --git a/test/IDE/print_synthesized_extensions.swift b/test/IDE/print_synthesized_extensions.swift index 35779e7722e..4cb8ab43a77 100644 --- a/test/IDE/print_synthesized_extensions.swift +++ b/test/IDE/print_synthesized_extensions.swift @@ -244,8 +244,8 @@ public extension P7 { // CHECK5: public struct S10 : P1 { // CHECK5-NEXT: public typealias T1 = print_synthesized_extensions.S9<Int> // CHECK5-NEXT: public typealias T2 = print_synthesized_extensions.S9<Int> -// CHECK5-NEXT: public func f1(t: print_synthesized_extensions.S10.Type.T1) -> print_synthesized_extensions.S10.Type.T1 -// CHECK5-NEXT: public func f2(t: print_synthesized_extensions.S10.Type.T2) -> print_synthesized_extensions.S10.Type.T2 +// CHECK5-NEXT: public func f1(t: print_synthesized_extensions.S10.T1) -> print_synthesized_extensions.S10.T1 +// CHECK5-NEXT: public func f2(t: print_synthesized_extensions.S10.T2) -> print_synthesized_extensions.S10.T2 // CHECK5-NEXT: public func p3Func(i: Int) -> Int // CHECK5-NEXT: public func ef5(t: S9<Int>) // CHECK5-NEXT: public func S9IntFunc() @@ -264,16 +264,16 @@ public extension P7 { // CHECK8: public struct S4<T> : P1 { // CHECK8-NEXT: public typealias T1 = Int // CHECK8-NEXT: public typealias T2 = Int -// CHECK8-NEXT: public func f1(t: T1) -> T1 -// CHECK8-NEXT: public func f2(t: T2) -> T2 +// CHECK8-NEXT: public func f1(t: print_synthesized_extensions.S4.T1) -> print_synthesized_extensions.S4.T1 +// CHECK8-NEXT: public func f2(t: print_synthesized_extensions.S4.T2) -> print_synthesized_extensions.S4.T2 // CHECK8-NEXT: public func p1IntFunc(i: Int) -> Int // CHECK8-NEXT: } // CHECK9: public struct S6<T> : P1 { // CHECK9-NEXT: public typealias T1 = print_synthesized_extensions.S5 // CHECK9-NEXT: public typealias T2 = print_synthesized_extensions.S5 -// CHECK9-NEXT: public func f1(t: print_synthesized_extensions.S6.Type.T1) -> print_synthesized_extensions.S6.Type.T1 -// CHECK9-NEXT: public func f2(t: print_synthesized_extensions.S6.Type.T2) -> print_synthesized_extensions.S6.Type.T2 +// CHECK9-NEXT: public func f1(t: print_synthesized_extensions.S6.T1) -> print_synthesized_extensions.S6.T1 +// CHECK9-NEXT: public func f2(t: print_synthesized_extensions.S6.T2) -> print_synthesized_extensions.S6.T2 // CHECK9-NEXT: public func f3() // CHECK9-NEXT: public func fromActualExtension() // CHECK9-NEXT: public func p3Func(i: Int) -> Int diff --git a/test/SourceKit/InterfaceGen/gen_stdlib.swift b/test/SourceKit/InterfaceGen/gen_stdlib.swift index 3a57d59de1b..bbb18030d9e 100644 --- a/test/SourceKit/InterfaceGen/gen_stdlib.swift +++ b/test/SourceKit/InterfaceGen/gen_stdlib.swift @@ -16,8 +16,8 @@ var x: Int // Check that extensions of nested decls are showing up. // CHECK-STDLIB-LABEL: extension String.UTF16View.Index { // CHECK-STDLIB: func samePosition(in utf8: String.UTF8View) -> String.UTF8View.Index? -// CHECK-STDLIB: func samePosition(in unicodeScalars: String.UnicodeScalarView) -> UnicodeScalarIndex? -// CHECK-STDLIB: func samePosition(in characters: String) -> Index? +// CHECK-STDLIB: func samePosition(in unicodeScalars: String.UnicodeScalarView) -> String.UnicodeScalarIndex? +// CHECK-STDLIB: func samePosition(in characters: String) -> String.Index? // CHECK-STDLIB-NEXT: } // CHECK-MUTATING-ATTR: mutating func diff --git a/test/TypeCoercion/integer_literals.swift b/test/TypeCoercion/integer_literals.swift index 8d652c05d6d..ab566c71546 100644 --- a/test/TypeCoercion/integer_literals.swift +++ b/test/TypeCoercion/integer_literals.swift @@ -47,7 +47,7 @@ struct meters : ExpressibleByIntegerLiteral { struct supermeters : ExpressibleByIntegerLiteral { // expected-error{{type 'supermeters' does not conform to protocol 'ExpressibleByIntegerLiteral'}} var value : meters - typealias IntegerLiteralType = meters // expected-note{{possibly intended match 'IntegerLiteralType' (aka 'meters') does not conform to '_ExpressibleByBuiltinIntegerLiteral'}} + typealias IntegerLiteralType = meters // expected-note{{possibly intended match 'supermeters.IntegerLiteralType' (aka 'meters') does not conform to '_ExpressibleByBuiltinIntegerLiteral'}} init(_integerLiteral value: meters) { self.value = value } diff --git a/test/attr/attr_specialize.swift b/test/attr/attr_specialize.swift index 0432389967f..69dea776a62 100644 --- a/test/attr/attr_specialize.swift +++ b/test/attr/attr_specialize.swift @@ -66,7 +66,7 @@ struct FloatElement : HasElt { typealias Element = Float } @_specialize(FloatElement) -@_specialize(IntElement) // expected-error{{' (T) -> ()' requires the types 'Element' (aka 'Int') and 'Float' be equivalent}} +@_specialize(IntElement) // expected-error{{' (T) -> ()' requires the types 'IntElement.Element' (aka 'Int') and 'Float' be equivalent}} func sameTypeRequirement(_ t: T) where T.Element == Float {} class Base {} diff --git a/test/decl/ext/protocol.swift b/test/decl/ext/protocol.swift index 3462cfb7e61..1ab840b5bdc 100644 --- a/test/decl/ext/protocol.swift +++ b/test/decl/ext/protocol.swift @@ -221,7 +221,7 @@ func testP4(_ s4a: S4a, s4b: S4b, s4c: S4c, s4d: S4d) { s4c.extP4Int() // okay var b1 = s4d.extP4a() // okay, "Bool" version b1 = true // checks type above - s4d.extP4Int() // expected-error{{'Int' is not convertible to 'AssocP4' (aka 'Bool')}} + s4d.extP4Int() // expected-error{{'Int' is not convertible to 'S4d.AssocP4' (aka 'Bool')}} _ = b1 } @@ -498,7 +498,7 @@ struct SConforms8c : PConforms8 { } func testSConforms8c() { - let s: SConforms8c.Assoc = "hello" // expected-error{{cannot convert value of type 'String' to specified type 'Assoc' (aka 'Int')}} + let s: SConforms8c.Assoc = "hello" // expected-error{{cannot convert value of type 'String' to specified type 'SConforms8c.Assoc' (aka 'Int')}} _ = s let i: SConforms8c.Assoc = 5 _ = i diff --git a/test/decl/protocol/conforms/associated_type.swift b/test/decl/protocol/conforms/associated_type.swift index 187dc4ecffc..c31e30bac95 100644 --- a/test/decl/protocol/conforms/associated_type.swift +++ b/test/decl/protocol/conforms/associated_type.swift @@ -6,6 +6,6 @@ protocol P { // expected-note{{requirement specified as 'Self.AssocP' : 'C' [wit associatedtype AssocP : C } -struct X : P { // expected-error{{'P' requires that 'AssocP' (aka 'Int') inherit from 'C'}} +struct X : P { // expected-error{{'P' requires that 'X.AssocP' (aka 'Int') inherit from 'C'}} typealias AssocP = Int } diff --git a/test/decl/protocol/protocols.swift b/test/decl/protocol/protocols.swift index 035cf2d0bfa..bd397e3d530 100644 --- a/test/decl/protocol/protocols.swift +++ b/test/decl/protocol/protocols.swift @@ -117,7 +117,7 @@ struct IsNotSimpleAssoc : SimpleAssoc {} // expected-error{{type 'IsNotSimpleAss protocol StreamWithAssoc { associatedtype Element - func get() -> Element // expected-note{{protocol requires function 'get()' with type '() -> Element'}} + func get() -> Element // expected-note{{protocol requires function 'get()' with type '() -> NotAStreamType.Element'}} } struct AnRange : StreamWithAssoc { @@ -170,7 +170,7 @@ extension IntIterator : SequenceViaStream { } struct NotSequence : SequenceViaStream { // expected-error{{type 'NotSequence' does not conform to protocol 'SequenceViaStream'}} - typealias SequenceStreamTypeType = Int // expected-note{{possibly intended match 'SequenceStreamTypeType' (aka 'Int') does not conform to 'IteratorProtocol'}} + typealias SequenceStreamTypeType = Int // expected-note{{possibly intended match 'NotSequence.SequenceStreamTypeType' (aka 'Int') does not conform to 'IteratorProtocol'}} func makeIterator() -> Int {} } diff --git a/test/decl/protocol/req/func.swift b/test/decl/protocol/req/func.swift index 5714bd39bec..38021b15611 100644 --- a/test/decl/protocol/req/func.swift +++ b/test/decl/protocol/req/func.swift @@ -23,7 +23,7 @@ struct X1b : P1 { protocol P2 { associatedtype Assoc : P1 // expected-note{{ambiguous inference of associated type 'Assoc': 'X1a' vs. 'X1b'}} // expected-note@-1{{protocol requires nested type 'Assoc'}} - func f1(_ x: Assoc) // expected-note{{protocol requires function 'f1' with type '(Assoc) -> ()'}} expected-note{{protocol requires function 'f1' with type '(Assoc) -> ()'}} + func f1(_ x: Assoc) // expected-note{{protocol requires function 'f1' with type '(X2w.Assoc) -> ()'}} expected-note{{protocol requires function 'f1' with type '(X2y.Assoc) -> ()'}} } // Exact match. @@ -88,7 +88,7 @@ prefix operator ~~ protocol P3 { associatedtype Assoc : P1 - static prefix func ~~(_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X3z) -> Assoc'}} + static prefix func ~~(_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X3z) -> X3z.Assoc'}} } // Global operator match @@ -111,7 +111,7 @@ postfix func ~~(_: X3z) -> X1a {} // expected-note{{candidate is postfix, not pr postfix operator ~~ protocol P4 { associatedtype Assoc : P1 - static postfix func ~~ (_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X4z) -> Assoc'}} + static postfix func ~~ (_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X4z) -> X4z.Assoc'}} } // Global operator match diff --git a/test/multifile/Inputs/external-protocol-conformance/A.swift b/test/multifile/Inputs/external-protocol-conformance/A.swift index 9ebec4d410b..c1bdbf04ca0 100644 --- a/test/multifile/Inputs/external-protocol-conformance/A.swift +++ b/test/multifile/Inputs/external-protocol-conformance/A.swift @@ -6,5 +6,5 @@ protocol P { } struct A : P { // expected-error {{type 'A' does not conform to protocol 'P'}} - typealias Assoc = Int // expected-note {{possibly intended match 'Assoc' (aka 'Int') does not conform to 'PHelper'}} + typealias Assoc = Int // expected-note {{possibly intended match 'A.Assoc' (aka 'Int') does not conform to 'PHelper'}} } diff --git a/test/stmt/foreach.swift b/test/stmt/foreach.swift index 0a89b47a86a..86b4619ffd2 100644 --- a/test/stmt/foreach.swift +++ b/test/stmt/foreach.swift @@ -27,7 +27,7 @@ func bad_containers_3(bc: BadContainer3) { struct BadIterator1 {} struct BadContainer4 : Sequence { // expected-error{{type 'BadContainer4' does not conform to protocol 'Sequence'}} - typealias Iterator = BadIterator1 // expected-note{{possibly intended match 'Iterator' (aka 'BadIterator1') does not conform to 'IteratorProtocol'}} + typealias Iterator = BadIterator1 // expected-note{{possibly intended match 'BadContainer4.Iterator' (aka 'BadIterator1') does not conform to 'IteratorProtocol'}} func makeIterator() -> BadIterator1 { } } @@ -70,7 +70,7 @@ func patterns(gir: GoodRange, gtr: GoodTupleIterator) { for (i, _) : (Int, Float) in gtr { sum = sum + i } - for (i, _) : (Int, Int) in gtr { sum = sum + i } // expected-error{{'Element' (aka '(Int, Float)') is not convertible to '(Int, Int)'}} + for (i, _) : (Int, Int) in gtr { sum = sum + i } // expected-error{{'GoodTupleIterator.Element' (aka '(Int, Float)') is not convertible to '(Int, Int)'}} for (i, f) in gtr {} }