MsgPack006 diagnostic error is not properly located on the attribute instead of the intended formatter class
This commit is contained in:
Родитель
74ce9db531
Коммит
070f3a9e11
|
@ -191,8 +191,9 @@ namespace MessagePackAnalyzer
|
|||
var isMessagePackFormatter = formatterType.AllInterfaces.Any(x => x.Equals(this.typeReferences.MessagePackFormatter));
|
||||
if (!isMessagePackFormatter)
|
||||
{
|
||||
var location = formatterAttr.ApplicationSyntaxReference.SyntaxTree.GetLocation(formatterAttr.ApplicationSyntaxReference.Span);
|
||||
var typeInfo = ImmutableDictionary.Create<string, string>().Add("type", formatterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat));
|
||||
this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, formatterType.Locations[0], typeInfo));
|
||||
this.ReportContext.Add(Diagnostic.Create(MessagePackAnalyzer.MessageFormatterMustBeMessagePackFormatter, location, typeInfo));
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -57,9 +57,9 @@ public class SomeClass {
|
|||
{
|
||||
string input = Preamble + @"using MessagePack.Formatters;
|
||||
|
||||
public class {|MsgPack006:InvalidMessageFormatter|} { }
|
||||
public class InvalidMessageFormatter { }
|
||||
|
||||
[MessagePackFormatter(typeof(InvalidMessageFormatter))]
|
||||
[{|MsgPack006:MessagePackFormatter(typeof(InvalidMessageFormatter))|}]
|
||||
public struct Foo
|
||||
{
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ public class SomeClass {
|
|||
await VerifyCS.VerifyAnalyzerAsync(input);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task NullStringKey()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче