提交 4cbe536a 编写于 作者: C CyrusNajmabadi

Removing diagnostic IDs from previous versions of the VB compiler that are no...

Removing diagnostic IDs from previous versions of the VB compiler that are no longer generated by Roslyn.
上级 9f2273e5
......@@ -2476,7 +2476,7 @@ interface I2
Assert.Equal(TypeKind.Interface, compilation7.GetTypeByMetadataName("I1").TypeKind);
}
[Fact]
[Fact, WorkItem(15435, "https://github.com/dotnet/roslyn/issues/15435")]
public void TestGettingAssemblyIdsFromDiagnostic1()
{
var text = @"
......@@ -2490,7 +2490,7 @@ class C : CSharpErrors.ClassMethods
var diagnostics = compilation.GetDiagnostics();
Assert.True(diagnostics.Any(d => d.Code == (int)ErrorCode.ERR_NoTypeDef));
foreach (var diagnostic in compilation.GetDiagnostics())
foreach (var diagnostic in diagnostics)
{
if (diagnostic.Code == (int)ErrorCode.ERR_NoTypeDef)
{
......
......@@ -2706,8 +2706,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Overrides Function IsUnreferencedAssemblyIdentityDiagnosticCode(code As Integer) As Boolean
Select Case code
Case ERRID.ERR_UnreferencedAssemblyEvent3,
ERRID.ERR_UnreferencedModuleBase3,
ERRID.ERR_UnreferencedModuleImplements3,
ERRID.ERR_UnreferencedAssembly3
Return True
......
......@@ -82,9 +82,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_UnreferencedAssemblyEvent3 = 30005
ERR_UnreferencedModuleEvent3 = 30006
' ERR_UnreferencedAssemblyBase3 = 30007
ERR_UnreferencedModuleBase3 = 30008
' ERR_UnreferencedModuleBase3 = 30008 - This has been superceded by ERR_UnreferencedModuleEvent3
' ERR_UnreferencedAssemblyImplements3 = 30009
ERR_UnreferencedModuleImplements3 = 30010
'ERR_UnreferencedModuleImplements3 = 30010 - This has been superceded by ERR_UnreferencedModuleEvent3
'ERR_CodegenError = 30011
ERR_LbExpectedEndIf = 30012
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Globalization
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
Imports Display = Microsoft.CodeAnalysis.VisualBasic.SymbolDisplay
Imports Microsoft.CodeAnalysis.Diagnostics
Namespace Microsoft.CodeAnalysis.VisualBasic
......@@ -875,10 +869,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
If errorInfo IsNot Nothing Then
Select Case errorInfo.Code
Case ERRID.ERR_UnreferencedModuleBase3,
ERRID.ERR_UnreferencedModuleImplements3
errorInfo = ErrorFactory.ErrorInfo(ERRID.ERR_UnreferencedModule3, errorInfo.Arguments(0), errorInfo.Arguments(1))
Case ERRID.ERR_UnsupportedType1
Select Case Me.Kind
......
......@@ -11190,15 +11190,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to assembly &apos;{0}&apos; containing the base class &apos;{1}&apos;. Add one to your project..
'''</summary>
Friend ReadOnly Property ERR_UnreferencedAssemblyBase3() As String
Get
Return ResourceManager.GetString("ERR_UnreferencedAssemblyBase3", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to assembly &apos;{0}&apos; containing the definition for event &apos;{1}&apos;. Add one to your project..
'''</summary>
......@@ -11208,15 +11199,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to assembly &apos;{0}&apos; containing the implemented interface &apos;{1}&apos;. Add one to your project..
'''</summary>
Friend ReadOnly Property ERR_UnreferencedAssemblyImplements3() As String
Get
Return ResourceManager.GetString("ERR_UnreferencedAssemblyImplements3", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to module &apos;{0}&apos; containing the type &apos;{1}&apos;. Add one to your project..
'''</summary>
......@@ -11226,15 +11208,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to module &apos;{0}&apos; containing the base class &apos;{1}&apos;. Add one to your project..
'''</summary>
Friend ReadOnly Property ERR_UnreferencedModuleBase3() As String
Get
Return ResourceManager.GetString("ERR_UnreferencedModuleBase3", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to module &apos;{0}&apos; containing the definition for event &apos;{1}&apos;. Add one to your project..
'''</summary>
......@@ -11244,15 +11217,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reference required to module &apos;{0}&apos; containing the implemented interface &apos;{1}&apos;. Add one to your project..
'''</summary>
Friend ReadOnly Property ERR_UnreferencedModuleImplements3() As String
Get
Return ResourceManager.GetString("ERR_UnreferencedModuleImplements3", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Field &apos;{0}.{1}&apos; has an invalid constant value..
'''</summary>
......
......@@ -285,18 +285,6 @@
<data name="ERR_UnreferencedModuleEvent3" xml:space="preserve">
<value>Reference required to module '{0}' containing the definition for event '{1}'. Add one to your project.</value>
</data>
<data name="ERR_UnreferencedAssemblyBase3" xml:space="preserve">
<value>Reference required to assembly '{0}' containing the base class '{1}'. Add one to your project.</value>
</data>
<data name="ERR_UnreferencedModuleBase3" xml:space="preserve">
<value>Reference required to module '{0}' containing the base class '{1}'. Add one to your project.</value>
</data>
<data name="ERR_UnreferencedAssemblyImplements3" xml:space="preserve">
<value>Reference required to assembly '{0}' containing the implemented interface '{1}'. Add one to your project.</value>
</data>
<data name="ERR_UnreferencedModuleImplements3" xml:space="preserve">
<value>Reference required to module '{0}' containing the implemented interface '{1}'. Add one to your project.</value>
</data>
<data name="ERR_LbExpectedEndIf" xml:space="preserve">
<value>'#If' block must end with a matching '#End If'.</value>
</data>
......
......@@ -675,5 +675,38 @@ BC30652: Reference required to assembly 'mincorlib, Version=0.0.0.0, Culture=neu
Assert.Equal(TypeKind.Interface, compilation7.GetTypeByMetadataName("I1").TypeKind)
End Sub
<Fact, WorkItem(15435, "https://github.com/dotnet/roslyn/issues/15435")>
Public Sub TestGettingAssemblyIdsFromDiagnostic1()
Dim source =
<compilation>
<file name="a.vb">
Class C
Inherits ILErrors.ClassMethods
Public Overrides Function ReturnType1() As Integer
Return 0
End Function
Public Overrides Function ReturnType2() As Integer()
Return Nothing
End Function
End Class
</file>
</compilation>
Dim compilation = CompileWithMissingReference(source)
Dim Diagnostics = compilation.GetDiagnostics()
Assert.True(Diagnostics.Any(Function(d) d.Code = ERRID.ERR_UnreferencedAssembly3))
For Each d In Diagnostics
If d.Code = ERRID.ERR_UnreferencedAssembly3 Then
Dim actualAssemblyId = compilation.GetUnreferencedAssemblyIdentities(d).Single()
Dim expectedAssemblyId As AssemblyIdentity = Nothing
AssemblyIdentity.TryParseDisplayName("Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", expectedAssemblyId)
Assert.True(actualAssemblyId.Equals(expectedAssemblyId))
End If
Next
End Sub
End Class
End Namespace
End Namespace
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册