Skip to content

Commit f643f3d

Browse files
committed
[Evaluator] Add "through" to "declared here" request cycle notes
Make it a bit clearer that these are steps in the request cycle.
1 parent 13023de commit f643f3d

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

include/swift/AST/DiagnosticsCommon.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ NOTE(kind_declname_declared_here,none,
2727
"%0 %1 declared here", (DescriptiveDeclKind, DeclName))
2828
NOTE(decl_declared_here_with_kind,none,
2929
"%kind0 declared here", (const Decl *))
30+
NOTE(through_decl_declared_here_with_kind,none,
31+
"through %kind0 declared here", (const Decl *))
3032

3133
ERROR(not_implemented,none,
3234
"INTERNAL ERROR: feature not implemented: %0", (StringRef))

lib/AST/NameLookupRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void SuperclassDeclRequest::diagnoseCycle(DiagnosticEngine &diags) const {
5858

5959
void SuperclassDeclRequest::noteCycleStep(DiagnosticEngine &diags) const {
6060
auto decl = std::get<0>(getStorage());
61-
diags.diagnose(decl, diag::decl_declared_here_with_kind, decl);
61+
diags.diagnose(decl, diag::through_decl_declared_here_with_kind, decl);
6262
}
6363

6464
std::optional<ClassDecl *> SuperclassDeclRequest::getCachedResult() const {

lib/AST/TypeCheckRequests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void EnumRawTypeRequest::diagnoseCycle(DiagnosticEngine &diags) const {
217217

218218
void EnumRawTypeRequest::noteCycleStep(DiagnosticEngine &diags) const {
219219
auto *decl = std::get<0>(getStorage());
220-
diags.diagnose(decl, diag::decl_declared_here_with_kind, decl);
220+
diags.diagnose(decl, diag::through_decl_declared_here_with_kind, decl);
221221
}
222222

223223
//----------------------------------------------------------------------------//
@@ -248,7 +248,7 @@ void ProtocolRequiresClassRequest::diagnoseCycle(DiagnosticEngine &diags) const
248248

249249
void ProtocolRequiresClassRequest::noteCycleStep(DiagnosticEngine &diags) const {
250250
auto *proto = std::get<0>(getStorage());
251-
diags.diagnose(proto, diag::decl_declared_here_with_kind, proto);
251+
diags.diagnose(proto, diag::through_decl_declared_here_with_kind, proto);
252252
}
253253

254254
std::optional<bool> ProtocolRequiresClassRequest::getCachedResult() const {
@@ -272,7 +272,7 @@ void ExistentialConformsToSelfRequest::diagnoseCycle(DiagnosticEngine &diags) co
272272

273273
void ExistentialConformsToSelfRequest::noteCycleStep(DiagnosticEngine &diags) const {
274274
auto *proto = std::get<0>(getStorage());
275-
diags.diagnose(proto, diag::decl_declared_here_with_kind, proto);
275+
diags.diagnose(proto, diag::through_decl_declared_here_with_kind, proto);
276276
}
277277

278278
std::optional<bool> ExistentialConformsToSelfRequest::getCachedResult() const {
@@ -298,7 +298,7 @@ void HasSelfOrAssociatedTypeRequirementsRequest::diagnoseCycle(
298298
void HasSelfOrAssociatedTypeRequirementsRequest::noteCycleStep(
299299
DiagnosticEngine &diags) const {
300300
auto *proto = std::get<0>(getStorage());
301-
diags.diagnose(proto, diag::decl_declared_here_with_kind, proto);
301+
diags.diagnose(proto, diag::through_decl_declared_here_with_kind, proto);
302302
}
303303

304304
std::optional<bool>
@@ -1448,7 +1448,7 @@ void HasCircularInheritedProtocolsRequest::diagnoseCycle(
14481448
void HasCircularInheritedProtocolsRequest::noteCycleStep(
14491449
DiagnosticEngine &diags) const {
14501450
auto *decl = std::get<0>(getStorage());
1451-
diags.diagnose(decl, diag::decl_declared_here_with_kind, decl);
1451+
diags.diagnose(decl, diag::through_decl_declared_here_with_kind, decl);
14521452
}
14531453

14541454
//----------------------------------------------------------------------------//
@@ -1462,7 +1462,7 @@ void HasCircularRawValueRequest::diagnoseCycle(DiagnosticEngine &diags) const {
14621462

14631463
void HasCircularRawValueRequest::noteCycleStep(DiagnosticEngine &diags) const {
14641464
auto *decl = std::get<0>(getStorage());
1465-
diags.diagnose(decl, diag::decl_declared_here_with_kind, decl);
1465+
diags.diagnose(decl, diag::through_decl_declared_here_with_kind, decl);
14661466
}
14671467

14681468
//----------------------------------------------------------------------------//

test/decl/class/circular_inheritance.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ class Left // expected-error {{'Left' inherits from itself}}
55
class Hand {}
66
}
77

8-
class Right // expected-note {{class 'Right' declared here}}
8+
class Right // expected-note {{through class 'Right' declared here}}
99
: Left.Hand { // expected-note {{through reference here}}
1010
class Hand {}
1111
}
1212

1313
class C : B { } // expected-error{{'C' inherits from itself}}
14-
class B : A { } // expected-note{{class 'B' declared here}}
15-
class A : C { } // expected-note{{class 'A' declared here}}
14+
class B : A { } // expected-note{{through class 'B' declared here}}
15+
class A : C { } // expected-note{{through class 'A' declared here}}
1616

1717
class TrivialCycle : TrivialCycle {} // expected-error{{'TrivialCycle' inherits from itself}}
1818
protocol P : P {} // expected-error {{protocol 'P' refines itself}}

test/decl/protocol/protocols.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ struct DoesNotConform : Up {
113113

114114
protocol CircleStart : CircleEnd { func circle_start() } // expected-error 2 {{protocol 'CircleStart' refines itself}}
115115
protocol CircleMiddle : CircleStart { func circle_middle() }
116-
// expected-note@-1 2 {{protocol 'CircleMiddle' declared here}}
117-
protocol CircleEnd : CircleMiddle { func circle_end()} // expected-note 2 {{protocol 'CircleEnd' declared here}}
116+
// expected-note@-1 2 {{through protocol 'CircleMiddle' declared here}}
117+
protocol CircleEnd : CircleMiddle { func circle_end()} // expected-note 2 {{through protocol 'CircleEnd' declared here}}
118118

119119
protocol CircleEntry : CircleTrivial { }
120120
protocol CircleTrivial : CircleTrivial { } // expected-error {{protocol 'CircleTrivial' refines itself}}

test/type/explicit_existential_cyclic_protocol.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
do {
1010
do {
1111
protocol P1 : P2 {}
12-
// expected-no-explicit-any-note@-1 2 {{protocol 'P1' declared here}}
13-
// expected-explicit-any-note@-2 1 {{protocol 'P1' declared here}}
12+
// expected-no-explicit-any-note@-1 2 {{through protocol 'P1' declared here}}
13+
// expected-explicit-any-note@-2 1 {{through protocol 'P1' declared here}}
1414
protocol P2 : P1 {}
1515
// expected-no-explicit-any-error@-1 2 {{protocol 'P2' refines itself}}
1616
// expected-explicit-any-error@-2 1 {{protocol 'P2' refines itself}}
@@ -23,8 +23,8 @@ do {
2323
do {
2424
protocol P0 { associatedtype A }
2525
protocol P1 : P2, P0 {}
26-
// expected-no-explicit-any-note@-1 2 {{protocol 'P1' declared here}}
27-
// expected-explicit-any-note@-2 1 {{protocol 'P1' declared here}}
26+
// expected-no-explicit-any-note@-1 2 {{through protocol 'P1' declared here}}
27+
// expected-explicit-any-note@-2 1 {{through protocol 'P1' declared here}}
2828
protocol P2 : P1 {}
2929
// expected-no-explicit-any-error@-1 2 {{protocol 'P2' refines itself}}
3030
// expected-explicit-any-error@-2 1 {{protocol 'P2' refines itself}}

0 commit comments

Comments
 (0)