Skip to content

Commit b568a22

Browse files
committed
change naming & concretize diag message
1 parent 6cf25b1 commit b568a22

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,8 +3209,8 @@ ERROR(unsupported_recursive_struct,none,
32093209
"contains it",
32103210
(Type))
32113211

3212-
WARNING(type_not_constructible,none,
3213-
"value type is inconstructible", ())
3212+
WARNING(enum_not_constructible,none,
3213+
"enum with recursive-only cases is not constructible", ())
32143214
ERROR(recursive_enum_not_indirect,none,
32153215
"recursive enum %0 is not marked 'indirect'", (Type))
32163216
ERROR(unsupported_infinitely_sized_type,none,

lib/Sema/TypeCheckCircularity.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class CircularityChecker {
169169
bool diagnoseInfiniteRecursion(CanType parentType, ValueDecl *member,
170170
CanType memberType);
171171

172-
void diagnoseInconstructible(EnumDecl *E);
172+
void diagnoseNotConstructible(EnumDecl *E);
173173

174174
void addPathElementsTo(Path &path, CanType type);
175175
void addPathElement(Path &path, ValueDecl *member, CanType memberType);
@@ -275,7 +275,7 @@ bool CircularityChecker::expandEnum(CanType type, EnumDecl *E,
275275
unsigned depth) {
276276
// Indirect enums are representational leaves.
277277
if (E->isIndirect()) {
278-
diagnoseInconstructible(E);
278+
diagnoseNotConstructible(E);
279279
return false;
280280
}
281281

@@ -303,7 +303,7 @@ bool CircularityChecker::expandEnum(CanType type, EnumDecl *E,
303303
if (addMember(type, elt, eltType, depth))
304304
return true;
305305
}
306-
diagnoseInconstructible(E);
306+
diagnoseNotConstructible(E);
307307

308308
return false;
309309
}
@@ -608,9 +608,9 @@ bool CircularityChecker::diagnoseInfiniteRecursion(CanType parentType,
608608
return true;
609609
}
610610

611-
// Show a warning if the enum is inconstructible. The outcome of this method
612-
// is irrelevant.
613-
void CircularityChecker::diagnoseInconstructible(EnumDecl *E) {
611+
/// Show a warning if the enum is not constructible. The outcome of this method
612+
/// is irrelevant.
613+
void CircularityChecker::diagnoseNotConstructible(EnumDecl *E) {
614614

615615
auto containsType = [](TupleType *tuple, Type E) -> bool {
616616
for (auto type: tuple->getElementTypes()) {
@@ -619,7 +619,7 @@ void CircularityChecker::diagnoseInconstructible(EnumDecl *E) {
619619
}
620620
return false;
621621
};
622-
auto isInconstructible = [containsType, E]() -> bool {
622+
auto isNotConstructible = [containsType, E]() -> bool {
623623
auto elts = E->getAllElements();
624624
if (elts.empty())
625625
return false;
@@ -644,6 +644,6 @@ void CircularityChecker::diagnoseInconstructible(EnumDecl *E) {
644644
return true;
645645
};
646646

647-
if (isInconstructible())
648-
TC.diagnose(E, diag::type_not_constructible);
647+
if (isNotConstructible())
648+
TC.diagnose(E, diag::enum_not_constructible);
649649
}

test/Sema/unsupported_recursive_value_type.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ enum RecursiveByGenericSubstitutionEnum<T> {
4242
case A(T)
4343
}
4444

45-
enum InconstructibleEnum1 { // expected-warning {{value type is inconstructible}}
45+
enum InconstructibleEnum1 { // expected-warning {{enum with recursive-only cases is not constructible}}
4646
indirect case A(InconstructibleEnum1)
4747
}
4848
enum InconstructibleEnum2 { // OK
4949
indirect case A(InconstructibleEnum2)
5050
case B(Bool)
5151
indirect case C(Int, InconstructibleEnum2)
5252
}
53-
enum InconstructibleEnum3 { // expected-warning {{value type is inconstructible}}
53+
enum InconstructibleEnum3 { // expected-warning {{enum with recursive-only cases is not constructible}}
5454
indirect case B(Int, InconstructibleEnum3)
5555
}
56-
indirect enum InconstructibleEnum4 { // expected-warning {{value type is inconstructible}}
56+
indirect enum InconstructibleEnum4 { // expected-warning {{enum with recursive-only cases is not constructible}}
5757
case A(InconstructibleEnum4)
5858
}
59-
indirect enum InconstructibleEnum5 { // expected-warning {{value type is inconstructible}}
59+
indirect enum InconstructibleEnum5 { // expected-warning {{enum with recursive-only cases is not constructible}}
6060
case B(Int, InconstructibleEnum5)
6161
}
6262
indirect enum InconstructibleEnum6 { // OK

0 commit comments

Comments
 (0)