File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,9 @@ struct OverloadSignature {
216
216
// / Whether this is a enum element.
217
217
unsigned IsEnumElement : 1 ;
218
218
219
+ // / Whether this is a nominal type.
220
+ unsigned IsNominal : 1 ;
221
+
219
222
// / Whether this signature is part of a protocol extension.
220
223
unsigned InProtocolExtension : 1 ;
221
224
Original file line number Diff line number Diff line change @@ -2098,6 +2098,12 @@ bool swift::conflicting(ASTContext &ctx,
2098
2098
return false ;
2099
2099
}
2100
2100
2101
+ // Nominal types and enum elements always conflict with each other.
2102
+ if ((sig1.IsNominal && sig2.IsEnumElement ) ||
2103
+ (sig1.IsEnumElement && sig2.IsNominal )) {
2104
+ return true ;
2105
+ }
2106
+
2101
2107
// Enum elements always conflict with each other. At this point, they
2102
2108
// have the same base name but different types.
2103
2109
if (sig1.IsEnumElement && sig2.IsEnumElement ) {
@@ -2263,6 +2269,7 @@ OverloadSignature ValueDecl::getOverloadSignature() const {
2263
2269
signature.IsVariable = isa<VarDecl>(this );
2264
2270
signature.IsFunction = isa<AbstractFunctionDecl>(this );
2265
2271
signature.IsEnumElement = isa<EnumElementDecl>(this );
2272
+ signature.IsNominal = isa<NominalTypeDecl>(this );
2266
2273
2267
2274
// Unary operators also include prefix/postfix.
2268
2275
if (auto func = dyn_cast<FuncDecl>(this )) {
You can’t perform that action at this time.
0 commit comments