Skip to content

Commit

Permalink
Fixup VB error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz committed Feb 12, 2024
1 parent 873703e commit 448700c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
7 changes: 4 additions & 3 deletions src/Compilers/VisualBasic/Portable/Errors/Errors.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic

ERR_InvalidExperimentalDiagID = 37328

ERR_NextAvailable = 37329
ERR_LockTypeUnsupported = 37329

ERR_NextAvailable = 37330

'// WARNINGS BEGIN HERE
WRN_UseOfObsoleteSymbol2 = 40000
Expand Down Expand Up @@ -2011,8 +2013,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
WRN_AnalyzerReferencesNewerCompiler = 42506
WRN_DuplicateAnalyzerReference = 42507

ERR_LockTypeUnsupported = 42508
WRN_ConvertingLock = 42509
WRN_ConvertingLock = 42508

' // AVAILABLE 42600 - 49998
WRN_NextAvailable = 42600
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ ILockOperation (OperationKind.Lock, Type: null, IsInvalid) (Syntax: 'SyncLock l'
]]>.Value

Dim expectedDiagnostics = <![CDATA[
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock l'BIND:"SyncLock l"
~
]]>.Value
Expand Down Expand Up @@ -523,7 +523,7 @@ Namespace System.Threading
End Namespace]]>.Value

Dim expectedDiagnostics = <![CDATA[
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock l
~
]]>.Value
Expand Down
38 changes: 19 additions & 19 deletions src/Compilers/VisualBasic/Test/Semantic/Binding/SyncLockTests.vb
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
"BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock l
~
")
Expand Down Expand Up @@ -597,7 +597,7 @@ End Namespace
Dim comp = CreateCompilation(source)
If declaration = "Lock" Then
comp.AssertTheseDiagnostics(
"BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
"BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock l
~
")
Expand Down Expand Up @@ -661,25 +661,25 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
"BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
Dim o As Object = l
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
o = DirectCast(l, Object)
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
SyncLock DirectCast(l, Object)
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
o = CType(l, Object)
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
SyncLock CType(l, Object)
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
o = TryCast(l, Object)
~
BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
SyncLock TryCast(l, Object)
~
")
Expand Down Expand Up @@ -709,7 +709,7 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
"BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
Dim o As LockBase = l
~
")
Expand Down Expand Up @@ -739,7 +739,7 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
"BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
Dim o As ILockBase = l
~
")
Expand Down Expand Up @@ -799,22 +799,22 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
"BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock DirectCast(l, Lock)
~~~~~~~~~~~~~~~~~~~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock CType(l, Lock)
~~~~~~~~~~~~~~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock TryCast(l, Lock)
~~~~~~~~~~~~~~~~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock M1(l)
~~~~~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock M2(l)
~~~~~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock M3(l)
~~~~~
")
Expand All @@ -839,10 +839,10 @@ Namespace System.Threading
End Namespace
"
CreateCompilation(source).AssertTheseDiagnostics(
"BC42509: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
"BC42508: A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.
Dim o As Object = l
~
BC42508: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
BC37329: A value of type 'System.Threading.Lock' in SyncLock will use likely unintended monitor-based locking. Consider manually calling 'Enter' and 'Exit' methods in a Try/Finally block instead.
SyncLock CType(o, Lock)
~~~~~~~~~~~~~~
")
Expand Down

0 comments on commit 448700c

Please sign in to comment.