File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -310,6 +310,9 @@ struct OverloadSignature {
310
310
// / Whether this is a macro.
311
311
unsigned IsMacro : 1 ;
312
312
313
+ // / Whether this is a generic argument.
314
+ unsigned IsGenericArg : 1 ;
315
+
313
316
// / Whether this signature is part of a protocol extension.
314
317
unsigned InProtocolExtension : 1 ;
315
318
@@ -323,8 +326,10 @@ struct OverloadSignature {
323
326
OverloadSignature ()
324
327
: UnaryOperator(UnaryOperatorKind::None), IsInstanceMember(false ),
325
328
IsVariable (false ), IsFunction(false ), IsAsyncFunction(false ),
326
- IsDistributed(false ), InProtocolExtension(false ),
327
- InExtensionOfGenericType(false ), HasOpaqueReturnType(false ) { }
329
+ IsDistributed(false ), IsEnumElement(false ), IsNominal(false ),
330
+ IsTypeAlias(false ), IsMacro(false ), IsGenericArg(false ),
331
+ InProtocolExtension(false ), InExtensionOfGenericType(false ),
332
+ HasOpaqueReturnType(false ) { }
328
333
};
329
334
330
335
// / Determine whether two overload signatures conflict.
Original file line number Diff line number Diff line change @@ -3859,6 +3859,13 @@ bool swift::conflicting(ASTContext &ctx,
3859
3859
if (sig1.IsFunction != sig2.IsFunction )
3860
3860
return true ;
3861
3861
3862
+ // Gracefully handle the case where value generic arguments were introduced
3863
+ // as a conflicting value with static variables of the same name.
3864
+ if (sig1.IsGenericArg != sig2.IsGenericArg ) {
3865
+ *wouldConflictInSwift5 = true ;
3866
+ return true ;
3867
+ }
3868
+
3862
3869
// Variables always conflict with non-variables with the same signature.
3863
3870
// (e.g variables with zero argument functions, variables with type
3864
3871
// declarations)
@@ -4037,6 +4044,7 @@ OverloadSignature ValueDecl::getOverloadSignature() const {
4037
4044
signature.IsNominal = isa<NominalTypeDecl>(this );
4038
4045
signature.IsTypeAlias = isa<TypeAliasDecl>(this );
4039
4046
signature.IsMacro = isa<MacroDecl>(this );
4047
+ signature.IsGenericArg = isa<GenericTypeParamDecl>(this );
4040
4048
signature.HasOpaqueReturnType =
4041
4049
!signature.IsVariable && (bool )getOpaqueResultTypeDecl ();
4042
4050
You can’t perform that action at this time.
0 commit comments