未验证 提交 ef24d3fc 编写于 作者: J Julien Couvreur 提交者: GitHub

Merge pull request #32571 from YairHalberstadt/AllowObsoleteOnAccessor

Allow Obsolete Attribute on Accessors
......@@ -366,6 +366,16 @@ private BoundExpression BindNamedAttributeArgument(AttributeArgumentSyntax named
ReportDiagnosticsIfObsolete(diagnostics, namedArgumentNameSymbol, namedArgument, hasBaseReceiver: false);
if (namedArgumentNameSymbol.Kind == SymbolKind.Property)
{
var propertySymbol = (PropertySymbol)namedArgumentNameSymbol;
var setMethod = propertySymbol.GetOwnOrInheritedSetMethod();
if (setMethod != null)
{
ReportDiagnosticsIfObsolete(diagnostics, setMethod, namedArgument, hasBaseReceiver: false);
}
}
Debug.Assert(resultKind == LookupResultKind.Viable || wasError);
TypeSymbol namedArgumentType;
......
......@@ -762,6 +762,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Attribute &apos;{0}&apos; is not valid on event accessors. It is only valid on &apos;{1}&apos; declarations..
/// </summary>
internal static string ERR_AttributeNotOnEventAccessor {
get {
return ResourceManager.GetString("ERR_AttributeNotOnEventAccessor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Attribute &apos;{0}&apos; is not valid on this declaration type. It is only valid on &apos;{1}&apos; declarations..
/// </summary>
......@@ -11401,6 +11410,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to obsolete on property accessor.
/// </summary>
internal static string IDS_FeatureObsoleteOnPropertyAccessor {
get {
return ResourceManager.GetString("IDS_FeatureObsoleteOnPropertyAccessor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to optional parameter.
/// </summary>
......
......@@ -5829,4 +5829,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="WRN_SwitchExpressionNotExhaustiveForNull_Title" xml:space="preserve">
<value>The switch expression does not handle some null inputs.</value>
</data>
</root>
<data name="ERR_AttributeNotOnEventAccessor" xml:space="preserve">
<value>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</value>
</data>
<data name="IDS_FeatureObsoleteOnPropertyAccessor" xml:space="preserve">
<value>obsolete on property accessor</value>
</data>
</root>
\ No newline at end of file
......@@ -1598,7 +1598,7 @@ internal enum ErrorCode
ERR_PossibleAsyncIteratorWithoutYieldOrAwait = 8420,
ERR_StaticLocalFunctionCannotCaptureVariable = 8421,
ERR_StaticLocalFunctionCannotCaptureThis = 8422,
ERR_AttributeNotOnEventAccessor = 8423,
#region diagnostics introduced for recursive patterns
// 8501, // available
ERR_WrongNumberOfSubpatterns = 8502,
......
......@@ -175,7 +175,8 @@ internal enum MessageID
IDS_FeatureStaticLocalFunctions = MessageBase + 12755,
IDS_FeatureNameShadowingInNestedFunctions = MessageBase + 12756,
IDS_FeatureUnmanagedConstructedTypes = MessageBase + 12757,
IDS_FeatureObsoleteOnPropertyAccessor = MessageBase + 12758,
IDS_DefaultInterfaceImplementation = MessageBase + 12800,
IDS_BaseTypeInBaseExpression = MessageBase + 12801,
}
......@@ -282,6 +283,7 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
case MessageID.IDS_FeatureStaticLocalFunctions:
case MessageID.IDS_FeatureNameShadowingInNestedFunctions:
case MessageID.IDS_FeatureUnmanagedConstructedTypes: // semantic check
case MessageID.IDS_FeatureObsoleteOnPropertyAccessor:
case MessageID.IDS_DefaultInterfaceImplementation: // semantic check
case MessageID.IDS_BaseTypeInBaseExpression:
return LanguageVersion.CSharp8;
......
......@@ -55,12 +55,7 @@ private static ThreeState GetObsoleteContextState(Symbol symbol, bool forceCompl
{
while ((object)symbol != null)
{
// For property or event accessors, check the associated property or event instead.
if (symbol.IsAccessor())
{
symbol = ((MethodSymbol)symbol).AssociatedSymbol;
}
else if (symbol.Kind == SymbolKind.Field)
if (symbol.Kind == SymbolKind.Field)
{
// If this is the backing field of an event, look at the event instead.
var associatedSymbol = ((FieldSymbol)symbol).AssociatedSymbol;
......@@ -81,7 +76,15 @@ private static ThreeState GetObsoleteContextState(Symbol symbol, bool forceCompl
return state;
}
symbol = symbol.ContainingSymbol;
// For property or event accessors, check the associated property or event next.
if (symbol.IsAccessor())
{
symbol = ((MethodSymbol)symbol).AssociatedSymbol;
}
else
{
symbol = symbol.ContainingSymbol;
}
}
return ThreeState.False;
......
......@@ -1222,9 +1222,16 @@ private void DecodeWellKnownAttributeAppliedToMethod(ref DecodeWellKnownAttribut
{
if (this.IsAccessor())
{
// CS1667: Attribute '{0}' is not valid on property or event accessors. It is only valid on '{1}' declarations.
AttributeUsageInfo attributeUsage = arguments.Attribute.AttributeClass.GetAttributeUsageInfo();
arguments.Diagnostics.Add(ErrorCode.ERR_AttributeNotOnAccessor, arguments.AttributeSyntaxOpt.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
if (this is SourceEventAccessorSymbol)
{
// CS1667: Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.
AttributeUsageInfo attributeUsage = arguments.Attribute.AttributeClass.GetAttributeUsageInfo();
arguments.Diagnostics.Add(ErrorCode.ERR_AttributeNotOnEventAccessor, arguments.AttributeSyntaxOpt.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
}
else
{
MessageID.IDS_FeatureObsoleteOnPropertyAccessor.CheckFeatureAvailability(arguments.Diagnostics, arguments.AttributeSyntaxOpt.Location);
}
}
return true;
......
......@@ -32,6 +32,11 @@
<target state="translated">Ve výrazu as se nepovoluje použití typu odkazu s možnou hodnotou null {0}?; místo toho použijte základní typ {0}.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">Asynchronní příkaz foreach nejde použít pro proměnné typu {0}, protože {0} neobsahuje vhodnou veřejnou definici instance pro {1}.</target>
......@@ -742,6 +747,11 @@
<target state="translated">omezení obecného typu objektu</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">akce varování enable nebo safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Es ist unzulässig, den Nullable-Verweistyp "{0}?" in einem as-Ausdruck zu verwenden. Verwenden Sie stattdessen den zugrunde liegenden Typ "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">Eine asynchrone foreach-Anweisung kann nicht für Variablen vom Typ "{0}" verwendet werden, weil "{0}" keine geeignete öffentliche Instanzdefinition für "{1}" enthält.</target>
......@@ -742,6 +747,11 @@
<target state="translated">Einschränkung eines generischen Objekttyps</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">Warnaktion: "enable" oder "safeonly"</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">No se puede usar el tipo "{0}?" que acepta valores NULL en una expresión as; use en su lugar el tipo "{0}" subyacente.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">Una instrucción foreach asincrónica no puede funcionar en variables de tipo "{0}", porque "{0}" no contiene una definición de instancia pública adecuada para "{1}".</target>
......@@ -744,6 +749,11 @@
<target state="translated">restricción de tipo genérico de objeto</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">acción de advertencia "enable" o "safeonly"</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Il n'est pas correct d'utiliser le type de référence Nullable '{0}?' dans une expression as. Utilisez le type sous-jacent '{0}' à la place.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">L'instruction foreach asynchrone ne peut pas fonctionner sur des variables de type '{0}', car '{0}' ne contient aucune définition d'instance publique appropriée pour '{1}'</target>
......@@ -743,6 +748,11 @@
<target state="translated">contrainte de type générique d'objet</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">action d'avertissement enable ou safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Non è consentito usare il tipo riferimento nullable '{0}?' in un'espressione as. Usare il tipo sottostante '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza pubblica idonea per '{1}'</target>
......@@ -742,6 +747,11 @@
<target state="translated">vincolo di tipo generico object</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">azione di avviso enable o safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">as 式で Null 許容参照型 '{0}?' を使用することはできません。代わりに基になる型 '{0}' をご使用ください。</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">'{0}' は '{1}' の適切なパブリック インスタンス定義を含んでいないため、型 '{0}' の変数に対して非同期 foreach ステートメントを使用することはできません</target>
......@@ -742,6 +747,11 @@
<target state="translated">オブジェクト ジェネリック型の制約</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">警告アクション enable または safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">식에 nullable 참조 형식 '{0}'을(를) 사용하는 것은 올바르지 않습니다. 대신 기본 형식 '{0}'을(를) 사용하세요.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">'{0}' 형식 변수에서 비동기 foreach 문을 수행할 수 없습니다. '{0}'에는 '{1}'의 적합한 공용 인스턴스 정의가 없기 때문입니다.</target>
......@@ -742,6 +747,11 @@
<target state="translated">개체 제네릭 형식 제약 조건</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">경고 작업 enable 또는 safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Użycie typu odwołania dopuszczającego wartość null „{0}?” w wyrażeniu „as” jest niedozwolone. Zamiast tego użyj bazowego typu „{0}”.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">Asynchroniczna instrukcja foreach nie może operować na zmiennych typu „{0}”, ponieważ typ „{0}” nie zawiera odpowiedniej publicznej definicji wystąpienia elementu „{1}”</target>
......@@ -742,6 +747,11 @@
<target state="translated">ogólne ograniczenie typu obiektu</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">akcja warning: enable lub safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">É ilegal usar o tipo de referência anulável '{0}?' em uma expressão as; use o tipo subjacente '{0}' em seu lugar.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">A instrução foreach assíncrona não pode operar em variáveis do tipo '{0}' porque '{0}' não contém uma definição da instância pública adequada para '{1}'</target>
......@@ -742,6 +747,11 @@
<target state="translated">restrição de tipo genérico de objeto</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">ação de aviso enable ou safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Недопустимо использовать ссылочный тип "{0}", допускающий значения NULL, в выражении "as". Используйте вместо него базовый тип "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">Асинхронный оператор foreach не работает с переменными типа "{0}", так как "{0}" не содержит подходящее открытое определение экземпляра для "{1}".</target>
......@@ -742,6 +747,11 @@
<target state="translated">ограничение универсального типа для объекта</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">действие warning с enable или safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">Boş değer atanabilir '{0}?' başvuru türünün bir as ifadesinde kullanılması yasaktır; bunun yerine temel alınan '{0}' türünü kullanın.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">'{0}', '{1}' için uygun bir genel örnek tanımı içermediğinden zaman uyumsuz foreach deyimi '{0}' türündeki değişkenlerle çalışmaz</target>
......@@ -743,6 +748,11 @@
<target state="translated">nesne genel tür kısıtlamaları</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">enable veya safeonly uyarı eylemi</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">在 as 表达式中使用可以为 null 的引用类型“{0}?”是非法的;请改用基础类型“{0}”。</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">“{0}”不包含“{1}”的适当公共实例定义,因此异步 foreach 语句不能作用于“{0}”类型的变量</target>
......@@ -783,6 +788,11 @@
<target state="translated">对象泛型类型约束</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">警告操作 enable 或 safeonly</target>
......
......@@ -32,6 +32,11 @@
<target state="translated">在運算式中使用可為 Null 的參考型別 '{0}?' 不合法,請改用基礎類型 '{0}'。</target>
<note />
</trans-unit>
<trans-unit id="ERR_AttributeNotOnEventAccessor">
<source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source>
<target state="new">Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</target>
<note />
</trans-unit>
<trans-unit id="ERR_AwaitForEachMissingMember">
<source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance definition for '{1}'</source>
<target state="translated">因為 '{0}' 不包含適用於 '{1}' 的公用執行個體定義,所以非同步的 foreach 陳述式無法在類型為 '{0}' 的變數上運作</target>
......@@ -742,6 +747,11 @@
<target state="translated">物件泛型型別條件約束</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor">
<source>obsolete on property accessor</source>
<target state="new">obsolete on property accessor</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeaturePragmaWarningEnableOrSafeOnly">
<source>warning action enable or safeonly</source>
<target state="translated">警告動作 enable 或 safeonly</target>
......
......@@ -15233,9 +15233,6 @@ public static void Main()
}
";
var comp = CreateCompilation(text).VerifyDiagnostics(
// (8,10): error CS1667: Attribute 'Obsolete' is not valid on property or event accessors. It is only valid on 'class, struct, enum, constructor, method, property, indexer, field, event, interface, delegate' declarations.
// [Obsolete] // CS1667
Diagnostic(ErrorCode.ERR_AttributeNotOnAccessor, "Obsolete").WithArguments("System.ObsoleteAttribute", "class, struct, enum, constructor, method, property, indexer, field, event, interface, delegate"),
// (10,10): error CS1667: Attribute 'System.Diagnostics.Conditional' is not valid on property or event accessors. It is only valid on 'class, method' declarations.
// [System.Diagnostics.Conditional("Bernard")]
Diagnostic(ErrorCode.ERR_AttributeNotOnAccessor, "System.Diagnostics.Conditional").WithArguments("System.Diagnostics.Conditional", "class, method")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册