提交 64f00120 编写于 作者: J Jonathon Marolf

VisualBasicUnboundIdentifierDiagnosticAnalyzer fix

Fixes an off by one error in
VisualBasicUnboundIdentifierDiagnosticAnalyzer
上级 972e7e1b
......@@ -491,6 +491,14 @@ NewLines("Class Foo \n Private Class Bar \n Private v As Integer \n Public Sub N
NewLines("Imports System.Linq \n Class C \n Sub New() \n Dim s As Action = Sub() \n Dim a = New [|C|](0)"),
NewLines("Imports System.Linq \n Class C \n Private v As Integer \n Sub New() \n Dim s As Action = Sub() \n Dim a = New C(0)Public Sub New(v As Integer) \n Me.v = v \n End Sub \n End Class"))
End Sub
<WorkItem(5920, "https://github.com/dotnet/roslyn/issues/5920")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Sub TestGenerateConstructorInIncompleteLambda2()
Test(
NewLines("Imports System.Linq \n Class C \n Private v As Integer \n Public Sub New(v As Integer) \n Me.v = v \n End Sub \n Sub New() \n Dim s As Action = Sub() \n Dim a = New [|C|](0, 0)"),
NewLines("Imports System.Linq \n Class C \n Private v As Integer \n Private v1 As Integer \n Public Sub New(v As Integer) \n Me.v = v \n End Sub \n Sub New() \n Dim s As Action = Sub() \n Dim a = New C(0, 0) \n Public Sub New(v As Integer, v1 As Integer) \n Me.New(v) \n Me.v1 = v1 \n End Sub \n End Class"))
End Sub
End Class
End Class
......
......@@ -59,7 +59,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Diagnostics
Dim count = constructors.Value _
.WhereAsArray(Function(constructor) constructor.Parameters.Length = args.Count) _
.WhereAsArray(Function(constructor)
For index = 0 To constructor.Parameters.Length
For index = 0 To constructor.Parameters.Length - 1
Dim typeInfo = semanticModel.GetTypeInfo(args(index).GetExpression)
If Not constructor.Parameters(index).Type.Equals(typeInfo.ConvertedType) Then
Return False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册