File tree Expand file tree Collapse file tree 7 files changed +41
-8
lines changed Expand file tree Collapse file tree 7 files changed +41
-8
lines changed Original file line number Diff line number Diff line change @@ -368,8 +368,13 @@ Public Class InvocationOrIndexExpression
368
368
Return False
369
369
End If
370
370
371
- If CecilHelper.GetArrayRank(ArrayType) <> m_ArgumentList.Count Then
372
- Helper.AddError( Me , "Array dimensions are not correct." )
371
+ Dim arrayRank As Integer = CecilHelper.GetArrayRank(ArrayType)
372
+
373
+ If m_ArgumentList.Count > arrayRank Then
374
+ Compiler.Report.ShowMessage(Messages.VBNC30106, Location)
375
+ Return False
376
+ ElseIf m_ArgumentList.Count < arrayRank Then
377
+ Compiler.Report.ShowMessage(Messages.VBNC30105, Location)
373
378
Return False
374
379
End If
375
380
Original file line number Diff line number Diff line change @@ -695,14 +695,14 @@ Public Enum Messages
695
695
<Message(MessageLevel.Error)> VBNC30103 = 30103
696
696
697
697
''' <summary>
698
- ''' VBNC = "CHANGEME "
698
+ ''' VBNC = "Number of indices is less than the number of dimensions of the indexed array. "
699
699
''' VB = "Number of indices is less than the number of dimensions of the indexed array."
700
700
''' </summary>
701
701
''' <remarks></remarks>
702
702
<Message(MessageLevel.Error)> VBNC30105 = 30105
703
703
704
704
''' <summary>
705
- ''' VBNC = "CHANGEME "
705
+ ''' VBNC = "Number of indices exceeds the number of dimensions of the indexed array. "
706
706
''' VB = "Number of indices exceeds the number of dimensions of the indexed array."
707
707
''' </summary>
708
708
''' <remarks></remarks>
Original file line number Diff line number Diff line change 413
413
<value >CHANGEME</value >
414
414
</data >
415
415
<data name =" 30105" xml : space =" preserve" >
416
- <value >CHANGEME </value >
416
+ <value >Number of indices is less than the number of dimensions of the indexed array. </value >
417
417
</data >
418
418
<data name =" 30106" xml : space =" preserve" >
419
- <value >CHANGEME </value >
419
+ <value >Number of indices exceeds the number of dimensions of the indexed array. </value >
420
420
</data >
421
421
<data name =" 30107" xml : space =" preserve" >
422
422
<value >CHANGEME</value >
Original file line number Diff line number Diff line change 489
489
</Message >
490
490
<Message id =" 30105" level =" Error" >
491
491
<Comment >NC</Comment >
492
- <VBNCValue >CHANGEME </VBNCValue >
492
+ <VBNCValue >Number of indices is less than the number of dimensions of the indexed array. </VBNCValue >
493
493
<VBValue >Number of indices is less than the number of dimensions of the indexed array.</VBValue >
494
494
</Message >
495
495
<Message id =" 30106" level =" Error" >
496
496
<Comment >NC</Comment >
497
- <VBNCValue >CHANGEME </VBNCValue >
497
+ <VBNCValue >Number of indices exceeds the number of dimensions of the indexed array. </VBNCValue >
498
498
<VBValue >Number of indices exceeds the number of dimensions of the indexed array.</VBValue >
499
499
</Message >
500
500
<Message id =" 30107" level =" Error" >
Original file line number Diff line number Diff line change
1
+ Module Main
2
+
3
+ Sub Foo
4
+
5
+ Dim mdarr(,) As String
6
+ Dim var As String = mdarr( 0 )
7
+
8
+ End Sub
9
+
10
+ End Module
Original file line number Diff line number Diff line change
1
+ Module Main
2
+
3
+ Sub Foo
4
+
5
+ Dim arr() As String
6
+ Dim var As String = arr( 0 , 0 )
7
+
8
+ End Sub
9
+
10
+ End Module
Original file line number Diff line number Diff line change 24277
24277
<file>Errors\30444.vb</file>
24278
24278
<error line="6" number="30444" message="'Set' is already declared." />
24279
24279
</test>
24280
+ <test id="3146" name="30105" expectedexitcode="1" mytype="empty">
24281
+ <file>Errors\30105.vb</file>
24282
+ <error line="6" number="30105" message="Number of indices is less than the number of dimensions of the indexed array." />
24283
+ </test>
24284
+ <test id="3147" name="30106" expectedexitcode="1" mytype="empty">
24285
+ <file>Errors\30106.vb</file>
24286
+ <error line="6" number="30106" message="Number of indices exceeds the number of dimensions of the indexed array." />
24287
+ </test>
24280
24288
</rt>
You can’t perform that action at this time.
0 commit comments