Skip to content

Commit 7f6d3bc

Browse files
committed
ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it
1 parent 01086bc commit 7f6d3bc

File tree

85 files changed

+1223
-1220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1223
-1220
lines changed

include/swift/AST/PrintOptions.h

-6
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,6 @@ struct PrintOptions {
293293

294294
bool PrintImplicitAttrs = true;
295295

296-
/// Whether to print the \c any keyword for existential
297-
/// types.
298-
bool PrintExplicitAny = false;
299-
300296
/// Whether to desugar the constraint for an existential type.
301297
bool DesugarExistentialConstraint = false;
302298

@@ -607,7 +603,6 @@ struct PrintOptions {
607603
/// The print options used for formatting diagnostic arguments.
608604
static PrintOptions forDiagnosticArguments() {
609605
PrintOptions result;
610-
result.PrintExplicitAny = true;
611606
return result;
612607
}
613608

@@ -725,7 +720,6 @@ struct PrintOptions {
725720
static PrintOptions printQualifiedSILType() {
726721
PrintOptions result = PrintOptions::printSIL();
727722
result.FullyQualifiedTypesIfAmbiguous = true;
728-
result.PrintExplicitAny = true;
729723
return result;
730724
}
731725

lib/AST/ASTPrinter.cpp

+20-26
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
178178
PrintOptions::FunctionRepresentationMode::Full;
179179
result.AlwaysTryPrintParameterLabels = true;
180180
result.PrintSPIs = printSPIs;
181-
result.PrintExplicitAny = true;
182181
result.DesugarExistentialConstraint = true;
183182

184183
// We should print __consuming, __owned, etc for the module interface file.
@@ -5695,16 +5694,15 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
56955694
return opaque->getDecl()->hasExplicitGenericParams();
56965695
case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword:
56975696
return opaque->getDecl()->hasExplicitGenericParams() ||
5698-
isSimpleUnderPrintOptions(opaque->getExistentialType());
5697+
isSimpleUnderPrintOptions(opaque->getExistentialType()
5698+
->castTo<ExistentialType>()
5699+
->getConstraintType());
56995700
}
57005701
llvm_unreachable("bad opaque-return-type printing mode");
57015702
}
57025703
} else if (auto existential = dyn_cast<ExistentialType>(T.getPointer())) {
5703-
if (!Options.PrintExplicitAny || !existential->shouldPrintWithAny())
5704+
if (!existential->shouldPrintWithAny())
57045705
return isSimpleUnderPrintOptions(existential->getConstraintType());
5705-
} else if (auto existential = dyn_cast<ExistentialMetatypeType>(T.getPointer())) {
5706-
if (!Options.PrintExplicitAny)
5707-
return isSimpleUnderPrintOptions(existential->getInstanceType());
57085706
} else if (auto param = dyn_cast<GenericTypeParamType>(T.getPointer())) {
57095707
if (param->isParameterPack())
57105708
return false;
@@ -6176,7 +6174,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
61766174
}
61776175

61786176
Type instanceType = T->getInstanceType();
6179-
if (Options.PrintExplicitAny && T->is<ExistentialMetatypeType>()) {
6177+
if (T->is<ExistentialMetatypeType>()) {
61806178
Printer << "any ";
61816179

61826180
// FIXME: We need to replace nested existential metatypes so that
@@ -6188,27 +6186,23 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
61886186

61896187
return type;
61906188
}));
6191-
} else if (T->is<MetatypeType>() && instanceType->is<ExistentialType>()) {
6192-
// The 'any' keyword is needed to distinguish between existential
6193-
// metatypes and singleton metatypes. However, 'any' usually isn't
6194-
// printed for Any and AnyObject, because it's unnecessary to write
6195-
// 'any' with these specific constraints. Force printing with 'any'
6196-
// for the existential instance type in this case.
6197-
instanceType->getAs<ExistentialType>()->forcePrintWithAny([&](Type ty) {
6198-
printWithParensIfNotSimple(ty);
6199-
});
62006189
} else {
6201-
printWithParensIfNotSimple(instanceType);
6190+
assert(T->is<MetatypeType>());
6191+
if (instanceType->is<ExistentialType>()) {
6192+
// The 'any' keyword is needed to distinguish between existential
6193+
// metatypes and singleton metatypes. However, 'any' usually isn't
6194+
// printed for Any and AnyObject, because it's unnecessary to write
6195+
// 'any' with these specific constraints. Force printing with 'any'
6196+
// for the existential instance type in this case.
6197+
instanceType->getAs<ExistentialType>()->forcePrintWithAny([&](Type ty) {
6198+
printWithParensIfNotSimple(ty);
6199+
});
6200+
} else {
6201+
printWithParensIfNotSimple(instanceType);
6202+
}
62026203
}
62036204

6204-
// We spell normal metatypes of existential types as .Protocol.
6205-
if (isa<MetatypeType>(T) &&
6206-
T->getInstanceType()->isAnyExistentialType() &&
6207-
!Options.PrintExplicitAny) {
6208-
Printer << ".Protocol";
6209-
} else {
6210-
Printer << ".Type";
6211-
}
6205+
Printer << ".Type";
62126206
}
62136207

62146208
void visitModuleType(ModuleType *T) {
@@ -6835,7 +6829,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
68356829
}
68366830

68376831
void visitExistentialType(ExistentialType *T) {
6838-
if (Options.PrintExplicitAny && T->shouldPrintWithAny())
6832+
if (T->shouldPrintWithAny())
68396833
Printer << "any ";
68406834

68416835
// FIXME: The desugared type is used here only to support

lib/SIL/IR/SILPrinter.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -4287,7 +4287,6 @@ PrintOptions PrintOptions::printSIL(const SILPrintContext *ctx) {
42874287
result.PrintInSILBody = true;
42884288
result.PreferTypeRepr = false;
42894289
result.PrintIfConfig = false;
4290-
result.PrintExplicitAny = true;
42914290
result.OpaqueReturnTypePrinting =
42924291
OpaqueReturnTypePrintingMode::StableReference;
42934292
if (ctx && ctx->printFullConvention())

lib/Sema/TypeCheckDecl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,7 @@ InterfaceTypeRequest::evaluate(Evaluator &eval, ValueDecl *D) const {
24062406
case DeclKind::Protocol: {
24072407
auto nominal = cast<NominalTypeDecl>(D);
24082408
Type declaredInterfaceTy = nominal->getDeclaredInterfaceType();
2409+
// FIXME: For a protocol, this returns a MetatypeType wrapping a ProtocolType, but should be a MetatypeType wrapping an ExistentialType ('(any P).Type', not 'P.Type').
24092410
return MetatypeType::get(declaredInterfaceTy, Context);
24102411
}
24112412

test/ClangImporter/nested_protocol_name.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
// HEADER: class Trunk {
1313
// HEADER: init!()
14-
// HEADER: class func addLimb(_ limb: Trunk.Branch!)
15-
// HEADER: func addLimb(_ limb: Trunk.Branch!)
16-
// HEADER: func addLimbs(_ limbs: [Trunk.Branch]!)
14+
// HEADER: class func addLimb(_ limb: (any Trunk.Branch)!)
15+
// HEADER: func addLimb(_ limb: (any Trunk.Branch)!)
16+
// HEADER: func addLimbs(_ limbs: [any Trunk.Branch]!)
1717
// HEADER: }
1818
// HEADER: // NS_SWIFT_NAME(Trunk.Branch)
1919
// HEADER: protocol Branch {

test/ConstExtraction/ExtractGroups.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension String: Foo {}
6767
// CHECK-NEXT: },
6868
// CHECK-NEXT: {
6969
// CHECK-NEXT: "label": "array2",
70-
// CHECK-NEXT: "type": "Swift.Array<ExtractGroups.Foo>",
70+
// CHECK-NEXT: "type": "Swift.Array<any ExtractGroups.Foo>",
7171
// CHECK-NEXT: "isStatic": "false",
7272
// CHECK-NEXT: "isComputed": "false",
7373
// CHECK-NEXT: "file": "{{.*}}test{{/|\\\\}}ConstExtraction{{/|\\\\}}ExtractGroups.swift",
@@ -209,7 +209,7 @@ extension String: Foo {}
209209
// CHECK-NEXT: },
210210
// CHECK-NEXT: {
211211
// CHECK-NEXT: "label": "dict3",
212-
// CHECK-NEXT: "type": "Swift.Dictionary<Swift.String, ExtractGroups.Foo>",
212+
// CHECK-NEXT: "type": "Swift.Dictionary<Swift.String, any ExtractGroups.Foo>",
213213
// CHECK-NEXT: "isStatic": "false",
214214
// CHECK-NEXT: "isComputed": "false",
215215
// CHECK-NEXT: "file": "{{.*}}test{{/|\\\\}}ConstExtraction{{/|\\\\}}ExtractGroups.swift",

test/ConstExtraction/ExtractTypeValue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct TypeValuePropertyStruct : MyProto {
1616
}
1717

1818
// CHECK: "label": "birdTypes",
19-
// CHECK-NEXT: "type": "Swift.Array<ExtractTypeValue.Bird.Type>",
19+
// CHECK-NEXT: "type": "Swift.Array<any ExtractTypeValue.Bird.Type>",
2020
// CHECK-NEXT: "isStatic": "false",
2121
// CHECK-NEXT: "isComputed": "false",
2222
// CHECK-NEXT: "file": "{{.*}}ExtractTypeValue.swift",

test/ConstExtraction/ExtractTypes.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public struct Types : MyProto {
2020
}
2121

2222
// CHECK: "label": "types1",
23-
// CHECK-NEXT: "type": "Swift.Array<ExtractTypes.ContainerType.Type>",
23+
// CHECK-NEXT: "type": "Swift.Array<any ExtractTypes.ContainerType.Type>",
2424
// CHECK: "valueKind": "Array",
2525
// CHECK-NEXT: "value": [
2626
// CHECK-NEXT: {

test/Constraints/issue-58019.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
func fetch() {
66
// CHECK: open_existential_expr implicit type='Void'
7-
// CHECK: opaque_value_expr implicit type='MyError'
7+
// CHECK: opaque_value_expr implicit type='any MyError'
88
// CHECK-NOT: type='SryMap<$T{{.*}}>.Failure'
99
sryMap { return "" }
1010
.napError{ $0.abc() }

test/Constraints/issue-60806.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ enum NonBarBaz {
1818

1919
let _: Foo<Bar> = Foo<Bar> { (a: Bar) -> Void in
2020
switch a {
21-
// CHECK: (pattern_is type='Bar' value_cast Baz
21+
// CHECK: (pattern_is type='any Bar' value_cast Baz
2222
// CHECK-NEXT: (pattern_enum_element type='Baz' Baz.someCase
2323
case let .someCase(value) as Baz:
2424
print(value)

test/Constraints/same_types.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func testSameTypeCommutativity4<U, T>(_ t: T, _ u: U)
362362
// expected-warning@-2{{same-type requirement makes generic parameter 'T' non-generic}}
363363

364364
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity5@
365-
// CHECK-NEXT: Generic signature: <U, T where T : P1, T.[P1]Assoc == P3 & PPP>
365+
// CHECK-NEXT: Generic signature: <U, T where T : P1, T.[P1]Assoc == any P3 & PPP>
366366
func testSameTypeCommutativity5<U, T: P1>(_ t: T, _ u: U)
367367
where PPP & P3 == T.Assoc { } // Ok, equivalent to T.Assoc == PPP & P3
368368

test/Generics/rdar76750100.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class G<X : P1, Y : AnyObject> {}
88

99
class C {}
1010

11-
// CHECK-LABEL: Generic signature: <X, Y where X == P2, Y == C>
11+
// CHECK-LABEL: Generic signature: <X, Y where X == any P2, Y == C>
1212
extension G where X == P2, Y == C {
1313
func foo() {}
1414
}

test/Generics/redundant_requirement_self_conforming_protocol.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
struct G<T> {}
55

6-
// CHECK-LABEL: Generic signature: <T where T == Error>
6+
// CHECK-LABEL: Generic signature: <T where T == any Error>
77
extension G where T : Error, T == Error {}
88
// expected-warning@-1 {{redundant conformance constraint 'any Error' : 'Error'}}

test/Generics/superclass_constraint.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func g<T : Init & Derived>(_: T.Type) {
204204
// Binding a class-constrained generic parameter to a subclass existential is
205205
// not sound.
206206
struct G<T : Base> {}
207-
// expected-note@-1 2 {{requirement specified as 'T' : 'Base' [with T = Base & P]}}
207+
// expected-note@-1 2 {{requirement specified as 'T' : 'Base' [with T = any Base & P]}}
208208

209209
_ = G<Base & P>() // expected-error {{'G' requires that 'any Base & P' inherit from 'Base'}}
210210

test/Generics/superclass_requirement_and_objc_existential.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protocol Q {
1515
/// This is allowed, even though it's not fully sound.
1616

1717
// CHECK-LABEL: .f1@
18-
// CHECK-NEXT: Generic signature: <T where T : Q, T.[Q]A == C & P1>
18+
// CHECK-NEXT: Generic signature: <T where T : Q, T.[Q]A == any C & P1>
1919
func f1<T : Q>(_: T) where T.A : C, T.A == any (C & P1) {}
2020
// expected-warning@-1 {{redundant superclass constraint 'T.A' : 'C'}}
2121

test/IDE/complete_async_imported.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ func test(obj: MyObjCClass) async throws {
3636
// COMPLETE-NOT: method4()
3737
// COMPLETE-NOT: method5()
3838
// COMPLETE-DAG: Keyword[self]/CurrNominal: self[#MyObjCClass#]; name=self
39-
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method1({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; name=method1(completionHandler:); diagnostics=warning:'method1(completionHandler:)' has an async alternative that should be preferred in an async context
39+
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method1({#completionHandler: ((any Error)?) -> Void##((any Error)?) -> Void#})[#Void#]; name=method1(completionHandler:); diagnostics=warning:'method1(completionHandler:)' has an async alternative that should be preferred in an async context
4040
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method1()[' async'][' throws'][#Void#];
4141
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: named3()[' async'][' throws'][#Void#];
42-
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method4({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#];
43-
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method5({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#];
44-
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method6({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; name=method6(completionHandler:); diagnostics=warning:'method6(completionHandler:)' has an async alternative that should be preferred in an async context
42+
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method4({#completionHandler: ((any Error)?) -> Void##((any Error)?) -> Void#})[#Void#];
43+
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method5({#completionHandler: ((any Error)?) -> Void##((any Error)?) -> Void#})[#Void#];
44+
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method6({#completionHandler: ((any Error)?) -> Void##((any Error)?) -> Void#})[#Void#]; name=method6(completionHandler:); diagnostics=warning:'method6(completionHandler:)' has an async alternative that should be preferred in an async context
4545
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method6()[' async'][' throws'][#Void#];
46-
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method7({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; name=method7(completionHandler:); diagnostics=warning:'method7(completionHandler:)' has an async alternative that should be preferred in an async context
46+
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended: method7({#completionHandler: ((any Error)?) -> Void##((any Error)?) -> Void#})[#Void#]; name=method7(completionHandler:); diagnostics=warning:'method7(completionHandler:)' has an async alternative that should be preferred in an async context
4747
// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: named7()[' async'][' throws'][#Void#];
4848
}

test/IDE/complete_call_arg.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,8 @@ func testLValueBaseTyOfSubscript() {
11181118
var cache: [String: Codable] = [:]
11191119
if let cached = cache[#^LVALUEBASETY^#
11201120

1121-
// LVALUEBASETY-DAG: Decl[Subscript]/CurrNominal/Flair[ArgLabels]/IsSystem: ['[']{#(position): Dictionary<String, Codable>.Index#}[']'][#(key: String, value: Codable)#];
1122-
// LVALUEBASETY-DAG: Decl[Subscript]/CurrNominal/Flair[ArgLabels]/IsSystem: ['[']{#(key): String#}[']'][#@lvalue Codable?#];
1121+
// LVALUEBASETY-DAG: Decl[Subscript]/CurrNominal/Flair[ArgLabels]/IsSystem: ['[']{#(position): Dictionary<String, any Codable>.Index#}[']'][#(key: String, value: any Codable)#];
1122+
// LVALUEBASETY-DAG: Decl[Subscript]/CurrNominal/Flair[ArgLabels]/IsSystem: ['[']{#(key): String#}[']'][#@lvalue (any Codable)?#];
11231123
}
11241124

11251125
func testSkippedCallArgInInvalidResultBuilderBody() {

test/IDE/complete_crashes.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func badMembers2(_ a: BadMembers2) {
3131
// BAD_MEMBERS_2: Begin completions, 3 items
3232
// BAD_MEMBERS_2-DAG: Decl[InstanceVar]/CurrNominal: .prop[#Int#]{{; name=.+$}}
3333
// BAD_MEMBERS_2-DAG: Decl[Subscript]/CurrNominal: [{#(i): Int#}][#Double#]{{; name=.+$}}
34-
// BAD_MEMBERS_2-DAG: Keyword[self]/CurrNominal: .self[#BadMembers2#]; name=self
34+
// BAD_MEMBERS_2-DAG: Keyword[self]/CurrNominal: .self[#any BadMembers2#]; name=self
3535

3636
func globalFunc() {}
3737

test/IDE/complete_dynamic_lookup.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ protocol Bar { func bar() }
113113
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceMethod]/OtherModule[swift_ide_test]: .topLevelObjcProtocol_InstanceFunc1!()[#Void#]{{; name=.+$}}
114114
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceVar]/OtherModule[swift_ide_test]: .topLevelObjcProtocol_Property1[#Int?#]{{; name=.+$}}
115115
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[bar_swift_module]: [{#(i): Bar_ImportedObjcClass#}][#Int?#]{{; name=.+$}}
116-
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[foo_swift_module]: [{#(i): Foo_TopLevelObjcProtocol#}][#Int?#]{{; name=.+$}}
116+
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[foo_swift_module]: [{#(i): any Foo_TopLevelObjcProtocol#}][#Int?#]{{; name=.+$}}
117117
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[swift_ide_test]: [{#(i): Int16#}][#Int?#]{{; name=.+$}}
118118
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[foo_swift_module]: [{#(i): Int32#}][#Int?#]{{; name=.+$}}
119119
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[foo_swift_module]: [{#(i): Int64#}][#Int?#]{{; name=.+$}}
120120
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[swift_ide_test]: [{#(i): Int8#}][#Int?#]{{; name=.+$}}
121121
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[swift_ide_test]: [{#(i): TopLevelObjcClass#}][#Int?#]{{; name=.+$}}
122-
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[swift_ide_test]: [{#(i): TopLevelObjcProtocol#}][#Int?#]{{; name=.+$}}
122+
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[swift_ide_test]: [{#(i): any TopLevelObjcProtocol#}][#Int?#]{{; name=.+$}}
123123
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[baz_clang_module]: [{#(idx): Int32#}][#Any??#]{{; name=.+$}}
124124
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[baz_clang_module]: [{#(key): Any!#}][#Any??#]{{; name=.+$}}
125125
// GLOBAL_NEGATIVE-NOT:.objectAtIndexedSubscript

test/IDE/complete_exception.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ func test006() {
147147
} catch {
148148
#^INSIDE_CATCH1^#
149149
}
150-
// IMPLICIT_ERROR: Decl[LocalVar]/Local: error[#Error#]; name=error
150+
// IMPLICIT_ERROR: Decl[LocalVar]/Local: error[#any Error#]; name=error
151151
}
152152
func test007() {
153153
do {
154154
} catch let e {
155155
#^INSIDE_CATCH2^#
156156
}
157-
// EXPLICIT_ERROR_E: Decl[LocalVar]/Local: e[#Error#]; name=e
157+
// EXPLICIT_ERROR_E: Decl[LocalVar]/Local: e[#any Error#]; name=e
158158
}
159159
func test008() {
160160
do {
@@ -195,7 +195,7 @@ func test012() {
195195
error.#^INSIDE_CATCH_ERR_DOT1^#
196196
}
197197
}
198-
// ERROR_DOT: Keyword[self]/CurrNominal: self[#Error#]; name=self
198+
// ERROR_DOT: Keyword[self]/CurrNominal: self[#any Error#]; name=self
199199
func test013() {
200200
do {
201201
} catch let e {

test/IDE/complete_from_stdlib.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ func protocolExtCollection1a<C : Collection>(_ a: C) {
2121
}
2222

2323
// PRIVATE_NOMINAL_MEMBERS_2A-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: map({#(transform): (C.Element) throws -> T##(C.Element) throws -> T#})[' rethrows'][#[T]#];
24-
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2A-NOT: Decl{{.*}}: index({#before: Comparable#})
24+
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2A-NOT: Decl{{.*}}: index({#before: any Comparable#})
2525

2626
func protocolExtCollection1b(_ a: Collection) {
2727
a.#^PRIVATE_NOMINAL_MEMBERS_2B?check=PRIVATE_NOMINAL_MEMBERS_2B;check=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2B;check=NO_STDLIB_PRIVATE^#
2828
}
2929

30-
// PRIVATE_NOMINAL_MEMBERS_2B-DAG: map({#(transform): (Collection.Element) throws -> T##(Collection.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}}
31-
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2B-NOT: Decl{{.*}}: index({#before: Comparable#})
30+
// FIXME(https://github.com/apple/swift/issues/65696): We should not be showing this because (1) it cannot be accessed on the existential (2) we don't have the syntax and features to represent the projected type sig anyway.
31+
// PRIVATE_NOMINAL_MEMBERS_2B-DAG: map({#(transform): (any Collection.Element) throws -> T##(any Collection.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}}
32+
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2B-NOT: Decl{{.*}}: index({#before: any Comparable#})
3233

3334
func protocolExtCollection2<C : Collection where C.Index : BidirectionalIndex>(_ a: C) {
3435
a.#^PRIVATE_NOMINAL_MEMBERS_3?check=PRIVATE_NOMINAL_MEMBERS_3;check=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3;check=NO_STDLIB_PRIVATE^#

test/IDE/complete_in_closures.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class C {
316316
do {
317317
} catch {
318318
error.#^ERROR_IN_CLOSURE_IN_INITIALIZER^#
319-
// ERROR_IN_CLOSURE_IN_INITIALIZER-DAG: Keyword[self]/CurrNominal: self[#Error#]; name=self
319+
// ERROR_IN_CLOSURE_IN_INITIALIZER-DAG: Keyword[self]/CurrNominal: self[#any Error#]; name=self
320320
// ERROR_IN_CLOSURE_IN_INITIALIZER-DAG: Decl[InstanceVar]/CurrNominal: myErrorNumber[#Int#]; name=myErrorNumber
321321
}
322322
return ""

test/IDE/complete_keypath_member_lookup.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func testGenericUnderconstrained1<G: P>(r: G) {
150150
r.#^testGenericUnderconstrained1^#
151151
}
152152
// testGenericUnderconstrained1-NOT: CurrNominal
153-
// testGenericUnderconstrained1: Keyword[self]/CurrNominal: self[#{{[GP]}}#];
153+
// testGenericUnderconstrained1: Keyword[self]/CurrNominal: self[#{{any P|G}}#];
154154
// testGenericUnderconstrained1-NOT: CurrNominal
155155

156156
func testExistential1(r: P) {

0 commit comments

Comments
 (0)