提交 ae2b6e58 编写于 作者: L leppie

Implements #6061

上级 d365aba2
......@@ -11711,7 +11711,7 @@ internal class CSharpResources {
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; is not a recognized attribute location. All attributes in this block will be ignored..
/// Looks up a localized string similar to &apos;{0}&apos; is not a recognized attribute location. Valid attribute locations for this declaration are &apos;{1}&apos;. All attributes in this block will be ignored..
/// </summary>
internal static string WRN_InvalidAttributeLocation {
get {
......
......@@ -1758,7 +1758,7 @@ If such a class is used as a base class and if the deriving class defines a dest
<value>Not a valid attribute location for this declaration</value>
</data>
<data name="WRN_InvalidAttributeLocation" xml:space="preserve">
<value>'{0}' is not a recognized attribute location. All attributes in this block will be ignored.</value>
<value>'{0}' is not a recognized attribute location. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored.</value>
</data>
<data name="WRN_InvalidAttributeLocation_Title" xml:space="preserve">
<value>Not a recognized attribute location</value>
......
......@@ -462,6 +462,8 @@ private static bool MatchAttributeTarget(IAttributeTargetSymbol attributeTarget,
return isOwner;
}
AttributeLocation allowedTargets = attributesOwner.AllowedAttributeLocations;
AttributeLocation explicitTarget = targetOpt.GetAttributeLocation();
if (explicitTarget == AttributeLocation.None)
{
......@@ -470,13 +472,12 @@ private static bool MatchAttributeTarget(IAttributeTargetSymbol attributeTarget,
{
//NOTE: ValueText so that we accept targets like "@return", to match dev10 (DevDiv #2591).
diagnostics.Add(ErrorCode.WRN_InvalidAttributeLocation,
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ValueText);
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ValueText, allowedTargets.ToDisplayString());
}
return false;
}
AttributeLocation allowedTargets = attributesOwner.AllowedAttributeLocations;
if ((explicitTarget & allowedTargets) == 0)
{
// error: invalid target for symbol
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册