未验证 提交 b252adb7 编写于 作者: A AlekseyTs 提交者: GitHub

Make sure nullability mismatch in constraints specified in different partial...

Make sure nullability mismatch in constraints specified in different partial declarations (types/methods) are properly detected and reported. (#35272)

 Make sure nullability mismatch in constraints specified in different partial declarations (types/methods) are properly detected and reported.

Fixes #30229.
Fixes #35179.

Implements the following LDM decision:

For partial types, the invariant matching from type inference and merging. A mismatch
between two non-oblivious candidates produces an error. No warnings are produced.

For partial methods, nullability has to match with exception for oblivious and we produce warnings.
For the result, we use the implementation signature inside the implementation, and the
declaration signature for the callers.
上级 96cec735
......@@ -448,7 +448,7 @@ private void AddBound(TypeWithAnnotations addedBound, HashSet<TypeWithAnnotation
if (collectedBounds[methodTypeParameterIndex] == null)
{
collectedBounds[methodTypeParameterIndex] = new HashSet<TypeWithAnnotations>(TypeWithAnnotations.EqualsComparer.Instance);
collectedBounds[methodTypeParameterIndex] = new HashSet<TypeWithAnnotations>(TypeWithAnnotations.EqualsComparer.ConsiderEverythingComparer);
}
collectedBounds[methodTypeParameterIndex].Add(addedBound);
......
......@@ -8197,7 +8197,7 @@ internal class CSharpResources {
}
/// <summary>
/// Looks up a localized string similar to Partial method declarations of &apos;{0}&apos; have inconsistent type parameter constraints.
/// Looks up a localized string similar to Partial method declarations of &apos;{0}&apos; have inconsistent constraints for type parameter &apos;{1}&apos;.
/// </summary>
internal static string ERR_PartialMethodInconsistentConstraints {
get {
......@@ -15340,6 +15340,24 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Partial method declarations of &apos;{0}&apos; have inconsistent nullability in constraints for type parameter &apos;{1}&apos;.
/// </summary>
internal static string WRN_NullabilityMismatchInConstraintsOnPartialImplementation {
get {
return ResourceManager.GetString("WRN_NullabilityMismatchInConstraintsOnPartialImplementation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Partial method declarations have inconsistent nullability in constraints for type parameter.
/// </summary>
internal static string WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title {
get {
return ResourceManager.GetString("WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Nullability of reference types in explicit interface specifier doesn&apos;t match interface implemented by the type..
/// </summary>
......
......@@ -2124,7 +2124,7 @@ If such a class is used as a base class and if the deriving class defines a dest
<value>Both partial method declarations, '{0}' and '{1}', must use the same tuple element names.</value>
</data>
<data name="ERR_PartialMethodInconsistentConstraints" xml:space="preserve">
<value>Partial method declarations of '{0}' have inconsistent type parameter constraints</value>
<value>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</value>
</data>
<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>
......@@ -5910,4 +5910,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="IDS_OverrideWithConstraints" xml:space="preserve">
<value>constraints for override and explicit interface implementation methods</value>
</data>
<data name="WRN_NullabilityMismatchInConstraintsOnPartialImplementation" xml:space="preserve">
<value>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</value>
</data>
<data name="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title" xml:space="preserve">
<value>Partial method declarations have inconsistent nullability in constraints for type parameter</value>
</data>
</root>
......@@ -1700,6 +1700,8 @@ internal enum ErrorCode
ERR_OverrideRefConstraintNotSatisfied = 8665,
ERR_OverrideValConstraintNotSatisfied = 8666,
WRN_NullabilityMismatchInConstraintsOnPartialImplementation = 8667,
ERR_MultipleAnalyzerConfigsInSameDir = 8700,
ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation = 8701,
......
......@@ -376,6 +376,7 @@ internal static int GetWarningLevel(ErrorCode code)
case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial:
case ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation:
case ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation:
case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation:
......
......@@ -228,6 +228,7 @@ public static bool IsWarning(ErrorCode code)
case ErrorCode.WRN_NullLiteralMayIntroduceNullT:
case ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull:
case ErrorCode.WRN_ImplicitCopyInReadOnlyMember:
case ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation:
return true;
default:
return false;
......
......@@ -536,15 +536,14 @@ private static bool HaveSameConstraints(Symbol member1, TypeMap typeMap1, Symbol
return HaveSameConstraints(typeParameters1, typeMap1, typeParameters2, typeMap2);
}
public static bool HaveSameConstraints(ImmutableArray<TypeParameterSymbol> typeParameters1, TypeMap typeMap1, ImmutableArray<TypeParameterSymbol> typeParameters2, TypeMap typeMap2, bool includingNullability = false)
public static bool HaveSameConstraints(ImmutableArray<TypeParameterSymbol> typeParameters1, TypeMap typeMap1, ImmutableArray<TypeParameterSymbol> typeParameters2, TypeMap typeMap2)
{
Debug.Assert(typeParameters1.Length == typeParameters2.Length);
int arity = typeParameters1.Length;
for (int i = 0; i < arity; i++)
{
if (!HaveSameConstraints(typeParameters1[i], typeMap1, typeParameters2[i], typeMap2) ||
(includingNullability && !HaveSameNullabilityInConstraints(typeParameters1[i], typeMap1, typeParameters2[i], typeMap2, unknownNullabilityMatchesAny: false)))
if (!HaveSameConstraints(typeParameters1[i], typeMap1, typeParameters2[i], typeMap2))
{
return false;
}
......@@ -596,23 +595,20 @@ private static bool HaveSameTypeConstraints(TypeParameterSymbol typeParameter1,
AreConstraintTypesSubset(substitutedTypes2, substitutedTypes1, typeParameter1);
}
public static bool HaveSameNullabilityInConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2, bool unknownNullabilityMatchesAny = true)
public static bool HaveSameNullabilityInConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2)
{
if (!typeParameter1.IsValueType)
{
bool? isNotNullableIfReferenceType1 = typeParameter1.IsNotNullableIfReferenceType;
bool? isNotNullableIfReferenceType2 = typeParameter2.IsNotNullableIfReferenceType;
if (isNotNullableIfReferenceType1 != isNotNullableIfReferenceType2 &&
!(unknownNullabilityMatchesAny && (!isNotNullableIfReferenceType1.HasValue || !isNotNullableIfReferenceType2.HasValue)))
if (isNotNullableIfReferenceType1.HasValue && isNotNullableIfReferenceType2.HasValue &&
isNotNullableIfReferenceType1.GetValueOrDefault() != isNotNullableIfReferenceType2.GetValueOrDefault())
{
return false;
}
}
return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2,
unknownNullabilityMatchesAny ?
TypeSymbol.EqualsAllIgnoreOptionsPlusNullableWithUnknownMatchesAnyComparer :
TypeSymbol.EqualsAllIgnoreOptionsPlusNullableComparer);
return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2, TypeSymbol.EqualsAllIgnoreOptionsPlusNullableWithUnknownMatchesAnyComparer);
}
/// <summary>
......
......@@ -343,28 +343,11 @@ private ImmutableArray<TypeParameterConstraintClause> MakeTypeParameterConstrain
ImmutableArray<TypeParameterConstraintClause> constraintClauses,
DiagnosticBag diagnostics)
{
var typeParameters = TypeParameters;
int arity = typeParameters.Length;
Debug.Assert(constraintClauses.IsEarly());
Debug.Assert(constraintClauses.Length == arity);
for (int i = 0; i < arity; i++)
{
var constraint = constraintClauses[i];
// Constraints defined on multiple partial declarations.
// Report any mismatched constraints.
foreach (var other in constraint.OtherPartialDeclarations)
{
if (!HaveSameConstraints(constraint, other))
{
// "Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}'"
diagnostics.Add(ErrorCode.ERR_PartialWrongConstraints, Locations[0], this, typeParameters[i]);
}
}
}
ImmutableArray<TypeParameterConstraintClause> results = MergeConstraintsForPartialDeclarations(constraintClauses, diagnostics);
ImmutableArray<TypeParameterConstraintClause> results = ConstraintsHelper.MakeTypeParameterConstraintsLate(typeParameters, constraintClauses, diagnostics);
results = ConstraintsHelper.MakeTypeParameterConstraintsLate(TypeParameters, results, diagnostics);
if (results.ContainsOnlyEmptyConstraintClauses())
{
......@@ -393,44 +376,193 @@ private static SyntaxList<TypeParameterConstraintClauseSyntax> GetConstraintClau
}
}
private static bool HaveSameConstraints(TypeParameterConstraintClause clause1, TypeParameterConstraintClause clause2)
/// <summary>
/// Note, only nullability aspects are merged if possible, other mismatches are treated as failures.
/// </summary>
private ImmutableArray<TypeParameterConstraintClause> MergeConstraintsForPartialDeclarations(ImmutableArray<TypeParameterConstraintClause> constraintClauses, DiagnosticBag diagnostics)
{
if ((clause1 == null) || (clause2 == null))
{
return (clause1 == null) && (clause2 == null);
}
ArrayBuilder<TypeParameterConstraintClause> builder = null;
var typeParameters = TypeParameters;
int arity = typeParameters.Length;
Debug.Assert(constraintClauses.Length == arity);
if (clause1.Constraints != clause2.Constraints)
for (int i = 0; i < arity; i++)
{
return false;
var constraint = constraintClauses[i];
if (constraint.OtherPartialDeclarations.IsEmpty)
{
continue;
}
TypeParameterConstraintKind mergedKind = constraint.Constraints;
ImmutableArray<TypeWithAnnotations> originalConstraintTypes = constraint.ConstraintTypes;
ArrayBuilder<TypeWithAnnotations> mergedConstraintTypes = null;
SmallDictionary<TypeWithAnnotations, int> originalConstraintTypesMap = null;
// Constraints defined on multiple partial declarations.
// Report any mismatched constraints.
foreach (var other in constraint.OtherPartialDeclarations)
{
if (!mergeConstraints(ref mergedKind, originalConstraintTypes, ref originalConstraintTypesMap, ref mergedConstraintTypes, other))
{
// "Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}'"
diagnostics.Add(ErrorCode.ERR_PartialWrongConstraints, Locations[0], this, typeParameters[i]);
}
}
if (constraint.Constraints != mergedKind || mergedConstraintTypes != null)
{
Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllNonNullableKinds) == (mergedKind & TypeParameterConstraintKind.AllNonNullableKinds));
Debug.Assert((mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 ||
(constraint.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0);
Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == (mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds) ||
(constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == TypeParameterConstraintKind.ReferenceType);
#if DEBUG
if (mergedConstraintTypes != null)
{
Debug.Assert(originalConstraintTypes.Length == mergedConstraintTypes.Count);
for (int j = 0; j < originalConstraintTypes.Length; j++)
{
Debug.Assert(TypeWithAnnotations.EqualsComparer.UnknownNullableModifierMatchesAnyComparer.Equals(originalConstraintTypes[j], mergedConstraintTypes[j]));
}
}
#endif
if (builder == null)
{
builder = ArrayBuilder<TypeParameterConstraintClause>.GetInstance(constraintClauses.Length);
builder.AddRange(constraintClauses);
}
builder[i] = TypeParameterConstraintClause.Create(mergedKind,
mergedConstraintTypes?.ToImmutableAndFree() ?? originalConstraintTypes,
constraint.TypeConstraintsSyntax);
}
}
if (clause1.ConstraintTypes.Length == 0 && clause2.ConstraintTypes.Length == 0)
if (builder != null)
{
return true;
constraintClauses = builder.ToImmutableAndFree();
}
var comparer = TypeWithAnnotations.EqualsComparer.Instance;
var constraintTypes1 = clause1.ConstraintTypes.ToImmutableHashSet(comparer);
var constraintTypes2 = clause2.ConstraintTypes.ToImmutableHashSet(comparer);
return constraintClauses;
foreach (var constraintType in constraintTypes1)
static bool mergeConstraints(ref TypeParameterConstraintKind mergedKind, ImmutableArray<TypeWithAnnotations> originalConstraintTypes,
ref SmallDictionary<TypeWithAnnotations, int> originalConstraintTypesMap, ref ArrayBuilder<TypeWithAnnotations> mergedConstraintTypes,
TypeParameterConstraintClause clause)
{
if (!constraintTypes2.Contains(constraintType))
bool result = true;
if ((mergedKind & TypeParameterConstraintKind.AllNonNullableKinds) != (clause.Constraints & TypeParameterConstraintKind.AllNonNullableKinds))
{
result = false;
}
if ((mergedKind & TypeParameterConstraintKind.ReferenceType) != 0 && (clause.Constraints & TypeParameterConstraintKind.ReferenceType) != 0)
{
// Try merging nullability of a 'class' constraint
TypeParameterConstraintKind clause1Constraints = mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds;
TypeParameterConstraintKind clause2Constraints = clause.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds;
if (clause1Constraints != clause2Constraints)
{
if (clause1Constraints == TypeParameterConstraintKind.ReferenceType) // Oblivious
{
// Take nullability from clause2
mergedKind = (mergedKind & (~TypeParameterConstraintKind.AllReferenceTypeKinds)) | clause2Constraints;
}
else if (clause2Constraints != TypeParameterConstraintKind.ReferenceType)
{
// Neither nullability is oblivious and they do not match. Cannot merge.
result = false;
}
}
}
if (originalConstraintTypes.Length == 0)
{
if (clause.ConstraintTypes.Length == 0)
{
// Try merging nullability of implied 'object' constraint
if (((mergedKind | clause.Constraints) & ~(TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType | TypeParameterConstraintKind.Constructor)) == 0 &&
(mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0 && // 'object~'
(clause.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0) // 'object?'
{
// Merged value is 'object?'
mergedKind &= ~TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType;
}
return result;
}
return false;
}
else if (clause.ConstraintTypes.Length == 0)
{
return false;
}
originalConstraintTypesMap ??= toDictionary(originalConstraintTypes);
SmallDictionary<TypeWithAnnotations, int> clauseConstraintTypesMap = toDictionary(clause.ConstraintTypes);
foreach (int index1 in originalConstraintTypesMap.Values)
{
TypeWithAnnotations constraintType1 = mergedConstraintTypes?[index1] ?? originalConstraintTypes[index1];
int index2;
if (!clauseConstraintTypesMap.TryGetValue(constraintType1, out index2))
{
// No matching type
result = false;
continue;
}
TypeWithAnnotations constraintType2 = clause.ConstraintTypes[index2];
if (!TypeWithAnnotations.EqualsComparer.UnknownNullableModifierMatchesAnyComparer.Equals(constraintType1, constraintType2))
{
// Nullability mismatch that doesn't involve oblivious
result = false;
continue;
}
if (!TypeWithAnnotations.EqualsComparer.ConsiderEverythingComparer.Equals(constraintType1, constraintType2))
{
// Mismatch with oblivious, merge
if (mergedConstraintTypes == null)
{
mergedConstraintTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance(originalConstraintTypes.Length);
mergedConstraintTypes.AddRange(originalConstraintTypes);
}
mergedConstraintTypes[index1] = constraintType1.MergeNullability(constraintType2, VarianceKind.None);
}
}
foreach (var constraintType in clauseConstraintTypesMap.Keys)
{
if (!originalConstraintTypesMap.ContainsKey(constraintType))
{
result = false;
break;
}
}
return result;
}
foreach (var constraintType in constraintTypes2)
static SmallDictionary<TypeWithAnnotations, int> toDictionary(ImmutableArray<TypeWithAnnotations> constraintTypes)
{
if (!constraintTypes1.Contains(constraintType))
var result = new SmallDictionary<TypeWithAnnotations, int>(TypeWithAnnotations.EqualsComparer.IgnoreNullableModifiersForReferenceTypesComparer);
for (int i = constraintTypes.Length - 1; i >= 0; i--)
{
return false;
result[constraintTypes[i]] = i; // Use the first type among the duplicates as the source of the nullable information
}
}
return true;
return result;
}
}
internal sealed override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotationsNoUseSiteDiagnostics
......
......@@ -1204,10 +1204,7 @@ private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, S
diagnostics.Add(ErrorCode.ERR_PartialMethodParamsDifference, implementation.Locations[0]);
}
if (!HaveSameConstraints(definition, implementation))
{
diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.Locations[0], implementation);
}
PartialMethodConstraintsChecks(definition, implementation, diagnostics);
ImmutableArray<ParameterSymbol> implementationParameters = implementation.Parameters;
ImmutableArray<ParameterSymbol> definitionParameters = definition.ConstructIfGeneric(implementation.TypeArgumentsWithAnnotations).Parameters;
......@@ -1221,28 +1218,39 @@ private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, S
}
}
/// <summary>
/// Returns true if the two partial methods have the same constraints.
/// </summary>
private static bool HaveSameConstraints(SourceOrdinaryMethodSymbol part1, SourceOrdinaryMethodSymbol part2)
private static void PartialMethodConstraintsChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, DiagnosticBag diagnostics)
{
Debug.Assert(!ReferenceEquals(part1, part2));
Debug.Assert(part1.Arity == part2.Arity);
Debug.Assert(!ReferenceEquals(definition, implementation));
Debug.Assert(definition.Arity == implementation.Arity);
var typeParameters1 = part1.TypeParameters;
var typeParameters1 = definition.TypeParameters;
int arity = typeParameters1.Length;
if (arity == 0)
{
return true;
return;
}
var typeParameters2 = part2.TypeParameters;
var typeParameters2 = implementation.TypeParameters;
var indexedTypeParameters = IndexedTypeParameterSymbol.Take(arity);
var typeMap1 = new TypeMap(typeParameters1, indexedTypeParameters, allowAlpha: true);
var typeMap2 = new TypeMap(typeParameters2, indexedTypeParameters, allowAlpha: true);
return MemberSignatureComparer.HaveSameConstraints(typeParameters1, typeMap1, typeParameters2, typeMap2, includingNullability: true);
// Report any mismatched method constraints.
for (int i = 0; i < arity; i++)
{
var typeParameter1 = typeParameters1[i];
var typeParameter2 = typeParameters2[i];
if (!MemberSignatureComparer.HaveSameConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))
{
diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.Locations[0], implementation, typeParameter2.Name);
}
else if (!MemberSignatureComparer.HaveSameNullabilityInConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation, implementation.Locations[0], implementation, typeParameter2.Name);
}
}
}
internal override bool CallsAreOmitted(SyntaxTree syntaxTree)
......
......@@ -418,7 +418,7 @@ internal override sealed void DecodeWellKnownAttribute(ref DecodeWellKnownAttrib
return false;
}
switch (constraints & (TypeParameterConstraintKind.NullableReferenceType | TypeParameterConstraintKind.NotNullableReferenceType))
switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds)
{
case TypeParameterConstraintKind.NullableReferenceType:
return true;
......
......@@ -30,6 +30,16 @@ internal enum TypeParameterConstraintKind
/// to distinguish between the two situations.
/// </summary>
ObliviousNullabilityIfReferenceType = 0x40,
/// <summary>
/// All bits involved into describing various aspects of 'class' constraint.
/// </summary>
AllReferenceTypeKinds = NullableReferenceType | NotNullableReferenceType,
/// <summary>
/// All bits except those that are involved into describilng various nullability aspects.
/// </summary>
AllNonNullableKinds = ReferenceType | ValueType | Constructor | Unmanaged,
}
/// <summary>
......@@ -79,7 +89,7 @@ internal sealed class TypeParameterConstraintClause
ImmutableArray<TypeParameterConstraintClause> otherPartialDeclarations)
{
#if DEBUG
switch (constraints & (TypeParameterConstraintKind.NullableReferenceType | TypeParameterConstraintKind.NotNullableReferenceType))
switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds)
{
case TypeParameterConstraintKind.None:
case TypeParameterConstraintKind.ReferenceType:
......
......@@ -404,10 +404,15 @@ public bool Equals(TypeWithAnnotations other, TypeCompareKind comparison)
internal sealed class EqualsComparer : EqualityComparer<TypeWithAnnotations>
{
internal static readonly EqualsComparer Instance = new EqualsComparer();
internal static readonly EqualsComparer ConsiderEverythingComparer = new EqualsComparer(TypeCompareKind.ConsiderEverything);
internal static readonly EqualsComparer IgnoreNullableModifiersForReferenceTypesComparer = new EqualsComparer(TypeCompareKind.IgnoreNullableModifiersForReferenceTypes);
internal static readonly EqualsComparer UnknownNullableModifierMatchesAnyComparer = new EqualsComparer(TypeCompareKind.UnknownNullableModifierMatchesAny);
private EqualsComparer()
private readonly TypeCompareKind _compareKind;
private EqualsComparer(TypeCompareKind compareKind)
{
_compareKind = compareKind;
}
public override int GetHashCode(TypeWithAnnotations obj)
......@@ -425,7 +430,7 @@ public override bool Equals(TypeWithAnnotations x, TypeWithAnnotations y)
{
return !y.HasType;
}
return x.Equals(y, TypeCompareKind.ConsiderEverything);
return x.Equals(y, _compareKind);
}
}
......
......@@ -1517,6 +1517,16 @@
<target state="translated">Možná hodnota null v omezeních parametru typu neodpovídá omezením parametru typu v implicitně implementované metodě rozhraní.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Možnost použití hodnoty null u typů odkazů v explicitním specifikátoru rozhraní neodpovídá rozhraní implementovanému podle tohoto typu.</target>
......@@ -4687,8 +4697,8 @@ Pokud se taková třída používá jako základní třída a pokud odvozující
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Pro deklarace částečné metody {0} platí omezení parametrů s nekonzistentními typy.</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Pro deklarace částečné metody {0} platí omezení parametrů s nekonzistentními typy.</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">Die NULL-Zulässigkeit in Einschränkungen für den Typparameter entspricht nicht den Einschränkungen für den Typparameter in der implizit implementierten Schnittstellenmethode.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Die NULL-Zulässigkeit von Verweistypen im expliziten Schnittstellenspezifizierer entspricht nicht der vom Typ implementierten Schnittstelle.</target>
......@@ -4687,8 +4697,8 @@ Wenn solch eine Klasse als Basisklasse verwendet wird und die ableitende Klasse
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Die Deklarationen der partiellen {0}-Methode enthalten inkonsistente Typparametereinschränkungen.</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Die Deklarationen der partiellen {0}-Methode enthalten inkonsistente Typparametereinschränkungen.</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1519,6 +1519,16 @@
<target state="translated">La nulabilidad de las restricciones del parámetro de tipo no coincide con las restricciones del parámetro de tipo del método de interfaz implementado de forma implícita</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">La nulabilidad de los tipos de referencia del especificador de interfaz explícito no coincide con la interfaz que el tipo implementa.</target>
......@@ -4689,8 +4699,8 @@ Si se utiliza una clase de este tipo como clase base y si la clase derivada defi
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Las declaraciones de métodos parciales de '{0}' tienen restricciones de parámetros de tipo incoherentes</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Las declaraciones de métodos parciales de '{0}' tienen restricciones de parámetros de tipo incoherentes</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1518,6 +1518,16 @@
<target state="translated">La nullabilité dans les contraintes pour le paramètre de type ne correspond pas aux contraintes pour le paramètre de type dans la méthode d'interface implémentée implicitement.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Les possibilités de valeur null des types référence dans le spécificateur d'interface explicite ne correspondent pas à l'interface implémentée par le type.</target>
......@@ -4688,8 +4698,8 @@ Si une telle classe est utilisée en tant que classe de base et si la classe dé
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Les déclarations de méthode partielles de '{0}' ont des contraintes de paramètre de type incohérentes</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Les déclarations de méthode partielles de '{0}' ont des contraintes de paramètre de type incohérentes</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">Il supporto dei valori Null nei vincoli del parametro di tipo non corrisponde ai vincoli per il parametro di tipo nel metodo di interfaccia implementato in modo implicito.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Il supporto dei valori Null dei tipi riferimento nell'identificatore di interfaccia esplicito non corrisponde all'interfaccia implementata dal tipo.</target>
......@@ -4687,8 +4697,8 @@ Se si usa tale classe come classe base e se la classe di derivazione definisce u
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Le dichiarazioni di metodo parziale di '{0}' contengono vincoli incoerenti per i parametri di tipo</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Le dichiarazioni di metodo parziale di '{0}' contengono vincoli incoerenti per i parametri di tipo</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">型パラメーターの制約の Null 許容性が、暗黙的に実装されたインターフェイス メソッドの型パラメーターの制約と一致しません。</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">明示的なインターフェイス指定子内の参照型の Null 許容性が、型によって実装されているインターフェイスと一致しません。</target>
......@@ -4687,8 +4697,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">{0}' の部分メソッド宣言には、矛盾する型パラメーター制約が含まれています。</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">{0}' の部分メソッド宣言には、矛盾する型パラメーター制約が含まれています。</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">형식 매개 변수에 대한 제약 조건의 Null 허용 여부가 암시적으로 구현된 인터페이스 메서드의 형식 매개 변수에 대한 제약 조건과 일치하지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">명시적 인터페이스 지정자의 참조 형식 Null 허용 여부가 형식에 의해 구현된 인터페이스와 일치하지 않습니다.</target>
......@@ -4687,8 +4697,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">{0}'의 부분 메서드(Partial Method) 선언에 일관성이 없는 형식 매개 변수 제약 조건이 있습니다.</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">{0}'의 부분 메서드(Partial Method) 선언에 일관성이 없는 형식 매개 변수 제약 조건이 있습니다.</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">Obsługa wartości null w ograniczeniach dla parametru typu jest niezgodna z ograniczeniami parametru typu w niejawnie implementowanej metodzie interfejsu.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Obsługa wartości null dla typów referencyjnych w jawnym specyfikatorze interfejsu jest niezgodna z interfejsem implementowanym przez typ.</target>
......@@ -4687,8 +4697,8 @@ Jeśli taka klasa zostanie użyta jako klasa bazowa i klasa pochodna definiuje d
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Częściowe deklaracje metody „{0}” mają niespójne ograniczenia parametrów typu</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Częściowe deklaracje metody „{0}” mają niespójne ograniczenia parametrów typu</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">A anulabilidade em restrições para parâmetro de tipo não corresponde às restrições para parâmetro de tipo em método de interface implicitamente implementado.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">A nulidade dos tipos de referência no especificador de interface explícito não corresponde à interface implementada pelo tipo.</target>
......@@ -4687,8 +4697,8 @@ Se tal classe for usada como uma classe base e se a classe derivada definir um d
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">As declarações de método parcial "{0}" têm restrições de parâmetro de tipo inconsistentes</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">As declarações de método parcial "{0}" têm restrições de parâmetro de tipo inconsistentes</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">Допустимость значения NULL в ограничениях для параметра типа не соответствует ограничениям параметра типа в явно реализованном методе интерфейса.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Допустимость значения NULL ссылочных типов в явном указателе интерфейсов не соответствует интерфейсу, реализованному типом.</target>
......@@ -4687,8 +4697,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">Объявления разделяемого метода "{0}" имеют несовместимые ограничения параметров типов.</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">Объявления разделяемого метода "{0}" имеют несовместимые ограничения параметров типов.</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1518,6 +1518,16 @@
<target state="translated">Tür parametresi için kısıtlamalardaki boş değer atanabilirlik, örtük olarak uygulanan arabirim metodundaki tür parametresi için kısıtlamalarla eşleşmiyor.</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">Açık arabirim belirticisindeki başvuru türlerinin boş değer atanabilirliği, tür tarafından uygulanan arabirimle eşleşmiyor.</target>
......@@ -4688,8 +4698,8 @@ Bu sınıf temel sınıf olarak kullanılırsa ve türetilen sınıf bir yıkıc
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">{0}' öğesinin kısmı yöntem bildirimleri tutarsız tür parametresi kısıtlamalarına sahip</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">{0}' öğesinin kısmı yöntem bildirimleri tutarsız tür parametresi kısıtlamalarına sahip</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1558,6 +1558,16 @@
<target state="translated">类型参数的约束中的为 Null 性与隐式实现接口方法中的类型参数的约束不匹配。</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">显式接口说明符中引用类型的 Null 性与该类型实现的接口不匹配。</target>
......@@ -4728,8 +4738,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">“{0}”的分部方法声明具有不一致的类型参数约束</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">“{0}”的分部方法声明具有不一致的类型参数约束</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -1517,6 +1517,16 @@
<target state="translated">方法的型別參數條件約束與介面方法的型別參數條件約束不符合。請考慮改用隱含的介面實作。</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation">
<source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source>
<target state="new">Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title">
<source>Partial method declarations have inconsistent nullability in constraints for type parameter</source>
<target state="new">Partial method declarations have inconsistent nullability in constraints for type parameter</target>
<note />
</trans-unit>
<trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface">
<source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source>
<target state="translated">明確介面指定名稱中參考類型可 NULL 性與類型所實作的介面不相符。</target>
......@@ -4687,8 +4697,8 @@ If such a class is used as a base class and if the deriving class defines a dest
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodInconsistentConstraints">
<source>Partial method declarations of '{0}' have inconsistent type parameter constraints</source>
<target state="translated">{0}' 的部分方法宣告出現不一致的類型參數條件約束</target>
<source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source>
<target state="needs-review-translation">{0}' 的部分方法宣告出現不一致的類型參數條件約束</target>
<note />
</trans-unit>
<trans-unit id="ERR_PartialMethodToDelegate">
......
......@@ -9515,9 +9515,9 @@ public partial interface I1
targetFramework: TargetFramework.NetStandardLatest);
compilation1.VerifyDiagnostics(
// (5,25): error CS0761: Partial method declarations of 'I1.M1<T>()' have inconsistent type parameter constraints
// (5,25): error CS0761: Partial method declarations of 'I1.M1<T>()' have inconsistent constraints for type parameter 'T'
// static partial void M1<T>() {}
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "M1").WithArguments("I1.M1<T>()").WithLocation(5, 25),
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "M1").WithArguments("I1.M1<T>()", "T").WithLocation(5, 25),
// (8,25): error CS0758: Both partial method declarations must use a params parameter or neither may use a params parameter
// static partial void M2(int[] x) {}
Diagnostic(ErrorCode.ERR_PartialMethodParamsDifference, "M2").WithLocation(8, 25),
......@@ -13835,36 +13835,60 @@ partial class C<X>
}";
// Note: Errors are reported on A1, A2, ... rather than A1<T>, A2<T, U>, ... See bug #9396.
CreateCompilation(source).VerifyDiagnostics(
// (38,18): error CS0761: Partial method declarations of 'C<X>.A1<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A1").WithArguments("C<X>.A1<T>()").WithLocation(38, 18),
// (39,18): error CS0761: Partial method declarations of 'C<X>.A2<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A2").WithArguments("C<X>.A2<T, U>()").WithLocation(39, 18),
// (40,18): error CS0761: Partial method declarations of 'C<X>.A3<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A3").WithArguments("C<X>.A3<T>()").WithLocation(40, 18),
// (41,18): error CS0761: Partial method declarations of 'C<X>.A4<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A4").WithArguments("C<X>.A4<T, U>()").WithLocation(41, 18),
// (43,18): error CS0761: Partial method declarations of 'C<X>.B1<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B1").WithArguments("C<X>.B1<T>()").WithLocation(43, 18),
// (44,18): error CS0761: Partial method declarations of 'C<X>.B2<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B2").WithArguments("C<X>.B2<T>()").WithLocation(44, 18),
// (45,18): error CS0761: Partial method declarations of 'C<X>.B3<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B3").WithArguments("C<X>.B3<T, U>()").WithLocation(45, 18),
// (47,18): error CS0761: Partial method declarations of 'C<X>.C1<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C1").WithArguments("C<X>.C1<T>()").WithLocation(47, 18),
// (48,18): error CS0761: Partial method declarations of 'C<X>.C2<T>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C2").WithArguments("C<X>.C2<T>()").WithLocation(48, 18),
// (49,18): error CS0761: Partial method declarations of 'C<X>.C3<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C3").WithArguments("C<X>.C3<T, U>()").WithLocation(49, 18),
// (22,18): error CS0761: Partial method declarations of 'C<X>.E1<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "E1").WithArguments("C<X>.E1<T, U>()").WithLocation(22, 18),
// (24,18): error CS0761: Partial method declarations of 'C<X>.F1<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "F1").WithArguments("C<X>.F1<T, U>()").WithLocation(24, 18),
// (26,18): error CS0761: Partial method declarations of 'C<X>.G1<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "G1").WithArguments("C<X>.G1<T, U>()").WithLocation(26, 18),
// (29,18): error CS0761: Partial method declarations of 'C<X>.H2<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "H2").WithArguments("C<X>.H2<T, U>()").WithLocation(29, 18),
// (32,18): error CS0761: Partial method declarations of 'C<X>.K1<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "K1").WithArguments("C<X>.K1<T, U>()").WithLocation(32, 18));
// (39,18): error CS0761: Partial method declarations of 'C<X>.A2<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void A2<T, U>() where T : struct where U : IB { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A2").WithArguments("C<X>.A2<T, U>()", "U").WithLocation(39, 18),
// (40,18): error CS0761: Partial method declarations of 'C<X>.A3<T>()' have inconsistent constraints for type parameter 'T'
// partial void A3<T>() where T : IA<IA<T>> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A3").WithArguments("C<X>.A3<T>()", "T").WithLocation(40, 18),
// (41,18): error CS0761: Partial method declarations of 'C<X>.A4<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void A4<T, U>() where T : struct, IA<U> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A4").WithArguments("C<X>.A4<T, U>()", "T").WithLocation(41, 18),
// (43,18): error CS0761: Partial method declarations of 'C<X>.B1<T>()' have inconsistent constraints for type parameter 'T'
// partial void B1<T>() where T : new() { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B1").WithArguments("C<X>.B1<T>()", "T").WithLocation(43, 18),
// (44,18): error CS0761: Partial method declarations of 'C<X>.B2<T>()' have inconsistent constraints for type parameter 'T'
// partial void B2<T>() where T : class, X, new() { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B2").WithArguments("C<X>.B2<T>()", "T").WithLocation(44, 18),
// (45,18): error CS0761: Partial method declarations of 'C<X>.B3<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void B3<T, U>() where T : IB, IA<T> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "B3").WithArguments("C<X>.B3<T, U>()", "T").WithLocation(45, 18),
// (47,18): error CS0761: Partial method declarations of 'C<X>.C1<T>()' have inconsistent constraints for type parameter 'T'
// partial void C1<T>() { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C1").WithArguments("C<X>.C1<T>()", "T").WithLocation(47, 18),
// (48,18): error CS0761: Partial method declarations of 'C<X>.C2<T>()' have inconsistent constraints for type parameter 'T'
// partial void C2<T>() where T : class { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C2").WithArguments("C<X>.C2<T>()", "T").WithLocation(48, 18),
// (49,18): error CS0761: Partial method declarations of 'C<X>.C3<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void C3<T, U>() where U : IA<T> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "C3").WithArguments("C<X>.C3<T, U>()", "U").WithLocation(49, 18),
// (22,18): error CS0761: Partial method declarations of 'C<X>.E1<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void E1<T, U>() where U : T { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "E1").WithArguments("C<X>.E1<T, U>()", "T").WithLocation(22, 18),
// (22,18): error CS0761: Partial method declarations of 'C<X>.E1<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void E1<T, U>() where U : T { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "E1").WithArguments("C<X>.E1<T, U>()", "U").WithLocation(22, 18),
// (24,18): error CS0761: Partial method declarations of 'C<X>.F1<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void F1<T, U>() where T : class { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "F1").WithArguments("C<X>.F1<T, U>()", "U").WithLocation(24, 18),
// (26,18): error CS0761: Partial method declarations of 'C<X>.G1<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void G1<T, U>() where T : class where U : T { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "G1").WithArguments("C<X>.G1<T, U>()", "U").WithLocation(26, 18),
// (29,18): error CS0761: Partial method declarations of 'C<X>.H2<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void H2<T, U>() where T : class where U : T { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "H2").WithArguments("C<X>.H2<T, U>()", "T").WithLocation(29, 18),
// (29,18): error CS0761: Partial method declarations of 'C<X>.H2<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void H2<T, U>() where T : class where U : T { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "H2").WithArguments("C<X>.H2<T, U>()", "U").WithLocation(29, 18),
// (32,18): error CS0761: Partial method declarations of 'C<X>.K1<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void K1<T, U>() where T : class where U : IA<T> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "K1").WithArguments("C<X>.K1<T, U>()", "T").WithLocation(32, 18),
// (32,18): error CS0761: Partial method declarations of 'C<X>.K1<T, U>()' have inconsistent constraints for type parameter 'U'
// partial void K1<T, U>() where T : class where U : IA<T> { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "K1").WithArguments("C<X>.K1<T, U>()", "U").WithLocation(32, 18),
// (38,18): error CS0761: Partial method declarations of 'C<X>.A1<T>()' have inconsistent constraints for type parameter 'T'
// partial void A1<T>() where T : class { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "A1").WithArguments("C<X>.A1<T>()", "T").WithLocation(38, 18));
}
[Fact]
......@@ -13899,8 +13923,9 @@ partial class C
}
}";
CreateCompilation(source).VerifyDiagnostics(
// (25,22): error CS0761: Partial method declarations of 'N.C.M4<T, U>()' have inconsistent type parameter constraints
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "M4").WithArguments("N.C.M4<T, U>()").WithLocation(25, 22));
// (25,22): error CS0761: Partial method declarations of 'C.M4<T, U>()' have inconsistent constraints for type parameter 'T'
// partial void M4<T, U>() where T : NIA { }
Diagnostic(ErrorCode.ERR_PartialMethodInconsistentConstraints, "M4").WithArguments("N.C.M4<T, U>()", "T").WithLocation(25, 22));
}
[Fact]
......
......@@ -276,6 +276,7 @@ public void WarningLevel_2()
case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial:
case ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation:
case ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation:
case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation:
case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册