Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed May 1, 2024
1 parent 4890b56 commit 4e01d6b
Show file tree
Hide file tree
Showing 24 changed files with 387 additions and 138 deletions.
12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2243,8 +2243,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<data name="ERR_PartialMethodToDelegate" xml:space="preserve">
<value>Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration</value>
</data>
<data name="ERR_PartialMethodStaticDifference" xml:space="preserve">
<value>Both partial method declarations must be static or neither may be static</value>
<data name="ERR_PartialMemberStaticDifference" xml:space="preserve">
<value>Both partial member declarations must be static or neither may be static</value>
</data>
<data name="ERR_PartialMethodUnsafeDifference" xml:space="preserve">
<value>Both partial method declarations must be unsafe or neither may be unsafe</value>
Expand Down Expand Up @@ -6539,14 +6539,14 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_PartialMemberAccessibilityDifference" xml:space="preserve">
<value>Both partial member declarations must have identical accessibility modifiers.</value>
</data>
<data name="ERR_PartialMethodExtendedModDifference" xml:space="preserve">
<value>Both partial method declarations must have identical combinations of 'virtual', 'override', 'sealed', and 'new' modifiers.</value>
<data name="ERR_PartialMemberExtendedModDifference" xml:space="preserve">
<value>Both partial member declarations must have identical combinations of 'virtual', 'override', 'sealed', and 'new' modifiers.</value>
</data>
<data name="ERR_PartialMethodReturnTypeDifference" xml:space="preserve">
<value>Both partial method declarations must have the same return type.</value>
</data>
<data name="ERR_PartialMethodRefReturnDifference" xml:space="preserve">
<value>Partial method declarations must have matching ref return values.</value>
<data name="ERR_PartialMemberRefReturnDifference" xml:space="preserve">
<value>Partial member declarations must have matching ref return values.</value>
</data>
<data name="WRN_PartialMethodTypeDifference" xml:space="preserve">
<value>Partial method declarations '{0}' and '{1}' have signature differences.</value>
Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ internal enum ErrorCode
ERR_PartialMethodMustHaveLatent = 759,
ERR_PartialMethodInconsistentConstraints = 761,
ERR_PartialMethodToDelegate = 762,
ERR_PartialMethodStaticDifference = 763,
ERR_PartialMemberStaticDifference = 763,
ERR_PartialMethodUnsafeDifference = 764,
ERR_PartialMethodInExpressionTree = 765,
// ERR_PartialMethodMustReturnVoid = 766, Removed as part of 'extended partial methods' feature
Expand Down Expand Up @@ -1810,7 +1810,7 @@ internal enum ErrorCode
ERR_PartialMethodWithOutParamMustHaveAccessMods = 8797,
ERR_PartialMethodWithExtendedModMustHaveAccessMods = 8798,
ERR_PartialMemberAccessibilityDifference = 8799,
ERR_PartialMethodExtendedModDifference = 8800,
ERR_PartialMemberExtendedModDifference = 8800,

ERR_SimpleProgramLocalIsReferencedOutsideOfTopLevelStatement = 8801,
ERR_SimpleProgramMultipleUnitsWithTopLevelStatements = 8802,
Expand All @@ -1832,7 +1832,7 @@ internal enum ErrorCode
ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric = 8816,

ERR_PartialMethodReturnTypeDifference = 8817,
ERR_PartialMethodRefReturnDifference = 8818,
ERR_PartialMemberRefReturnDifference = 8818,
WRN_NullabilityMismatchInReturnTypeOnPartial = 8819,

ERR_StaticAnonymousFunctionCannotCaptureVariable = 8820,
Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
case ErrorCode.ERR_PartialMethodMustHaveLatent:
case ErrorCode.ERR_PartialMethodInconsistentConstraints:
case ErrorCode.ERR_PartialMethodToDelegate:
case ErrorCode.ERR_PartialMethodStaticDifference:
case ErrorCode.ERR_PartialMemberStaticDifference:
case ErrorCode.ERR_PartialMethodUnsafeDifference:
case ErrorCode.ERR_PartialMethodInExpressionTree:
case ErrorCode.ERR_ExplicitImplCollisionOnRefOut:
Expand Down Expand Up @@ -2054,7 +2054,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
case ErrorCode.ERR_PartialMethodWithOutParamMustHaveAccessMods:
case ErrorCode.ERR_PartialMethodWithExtendedModMustHaveAccessMods:
case ErrorCode.ERR_PartialMemberAccessibilityDifference:
case ErrorCode.ERR_PartialMethodExtendedModDifference:
case ErrorCode.ERR_PartialMemberExtendedModDifference:
case ErrorCode.ERR_SimpleProgramLocalIsReferencedOutsideOfTopLevelStatement:
case ErrorCode.ERR_SimpleProgramMultipleUnitsWithTopLevelStatements:
case ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType:
Expand All @@ -2072,7 +2072,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
case ErrorCode.ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid:
case ErrorCode.ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric:
case ErrorCode.ERR_PartialMethodReturnTypeDifference:
case ErrorCode.ERR_PartialMethodRefReturnDifference:
case ErrorCode.ERR_PartialMemberRefReturnDifference:
case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial:
case ErrorCode.ERR_StaticAnonymousFunctionCannotCaptureVariable:
case ErrorCode.ERR_StaticAnonymousFunctionCannotCaptureThis:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,12 @@ private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, S

if (definition.RefKind != implementation.RefKind)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodRefReturnDifference, implementation.GetFirstLocation());
diagnostics.Add(ErrorCode.ERR_PartialMemberRefReturnDifference, implementation.GetFirstLocation());
}

if (definition.IsStatic != implementation.IsStatic)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodStaticDifference, implementation.GetFirstLocation());
diagnostics.Add(ErrorCode.ERR_PartialMemberStaticDifference, implementation.GetFirstLocation());
}

if (definition.IsDeclaredReadOnly != implementation.IsDeclaredReadOnly)
Expand Down Expand Up @@ -532,7 +532,7 @@ private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, S
|| definition.IsSealed != implementation.IsSealed
|| definition.IsNew != implementation.IsNew)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodExtendedModDifference, implementation.GetFirstLocation());
diagnostics.Add(ErrorCode.ERR_PartialMemberExtendedModDifference, implementation.GetFirstLocation());
}

PartialMethodConstraintsChecks(definition, implementation, diagnostics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,17 +599,40 @@ private void PartialPropertyChecks(SourcePropertySymbol implementation, BindingD
diagnostics.Add(ErrorCode.ERR_PartialMemberInconsistentTupleNames, implementation.GetFirstLocation(), this, implementation);
}

// PROTOTYPE(partial-properties): check ConsideringTupleNamesCreatesDifference and report error similar to indexers
if (RefKind != implementation.RefKind)
{
diagnostics.Add(ErrorCode.ERR_PartialMemberRefReturnDifference, implementation.GetFirstLocation());
}

if (IsStatic != implementation.IsStatic)
{
diagnostics.Add(ErrorCode.ERR_PartialMemberStaticDifference, implementation.GetFirstLocation());
}

if (HasReadOnlyModifier != implementation.HasReadOnlyModifier)
{
diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementation.GetFirstLocation());
}

if ((_modifiers & DeclarationModifiers.Unsafe) != (implementation._modifiers & DeclarationModifiers.Unsafe) && this.CompilationAllowsUnsafe()) // Don't cascade.
{
diagnostics.Add(ErrorCode.ERR_PartialMethodUnsafeDifference, implementation.GetFirstLocation());
}

// PROTOTYPE(partial-properties): test 'params' indexers

if (DeclaredAccessibility != implementation.DeclaredAccessibility
|| HasExplicitAccessModifier != implementation.HasExplicitAccessModifier)
{
diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementation.GetFirstLocation());
}

if (HasReadOnlyModifier != implementation.HasReadOnlyModifier)
if (IsVirtual != implementation.IsVirtual
|| IsOverride != implementation.IsOverride
|| IsSealed != implementation.IsSealed
|| IsNew != implementation.IsNew)
{
diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementation.GetFirstLocation());
diagnostics.Add(ErrorCode.ERR_PartialMemberExtendedModDifference, implementation.GetFirstLocation());
}

if (this.GetMethod is { } definitionGetAccessor && implementation.GetMethod is { } implementationGetAccessor)
Expand Down
12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e01d6b

Please sign in to comment.