+2005-1-7 Manjula GHM <mmanjula@novell.com>
+
+ *InheritanceC7.vb
+ *NameSpaceC5.vb
+ *OverrideC12.vb
+ *NameSpaceC7.vb
+ *OverrideC14.vb
+ *NameSpaceC9.vb
+ *OverrideC16.vb
+ *ScopeC2.vb
+ *NameSpaceC10.vb
+ *ShadowsC6.vb
+ *VariablesC6.vb
+ *ShadowsC8.vb
+ *InterfaceC10.vb
+ *InterfaceC12.vb
+ *MustInheritC10.vb
+ *InheritanceC6.vb
+ *NameSpaceC4.vb
+ *OverrideC11.vb
+ *NameSpaceC6.vb
+ *OverrideC13.vb
+ *NameSpaceC8.vb
+ *OverrideC15.vb
+ *OverrideC17.vb
+ *NotInheritableC4.vb
+ *ScopeC3.vb
+ *VariablesC5.vb
+ *ShadowsC7.vb
+ *InterfaceC11.vb
+ *InterfaceC13.vb
+ *MustInheritC9.vb
+
+ Above test cases are contributed by Sudharsan <vsudharsan@novell.com>
+
2004-12-20 Ritvik Mayank <mritvik@novell.com>
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 18
+REM ExpectedError: BC30610
+REM ErrorMessage: Class 'C2' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): Public MustOverride Sub fun().
+
+REM LineNo: 26
+REM ExpectedError: BC30376
+REM ErrorMessage: 'New' cannot be used on class 'C1' because it contains a 'MustOverride' member that has not been overridden.
+
+MustInherit Class C1
+ Public MustOverride Sub fun()
+End Class
+
+Class C2
+ Inherits C1
+ Public Sub G()
+ End Sub
+End Class
+
+Module InheritanceM
+ Sub Main()
+ Dim t1 as C1=new C1()
+ Dim t as C2=new C2()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 23
+REM ExpectedError: BC30266
+REM ErrorMessage: 'Private Overrides Sub fun1(i As Integer)' cannot override 'Public Overridable Sub fun1(i As Integer)' because they have different access levels.
+
+'Inheritance of the members with no scope are done in default public..
+
+Class A
+ Overridable Sub fun(ByVal i As Integer)
+ End Sub
+ Overridable Sub fun1(ByVal i As Integer)
+ End Sub
+End Class
+
+Class B
+ Inherits A
+ Public Overrides Sub fun(i As Integer)
+ End Sub
+ Private Overrides Sub fun1(i As Integer)
+ End Sub
+End Class
+
+Module Default1
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30149
+REM ErrorMessage: 'B' must implement 'Sub fun(a As Integer)' for interface 'A'.
+
+REM LineNo: 20
+REM ExpectedError: BC30401
+REM ErrorMessage: 'Cfun' cannot implement 'fun' because there is no matching sub on interface 'A'.
+
+Interface A
+ Sub fun(ByVal a As Integer)
+End Interface
+
+Class B
+ Implements A
+ Sub Cfun(ByVal a As String) Implements A.fun
+ End Sub
+End Class
+
+Module InterfaceI
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30149
+REM ErrorMessage: 'B' must implement 'Sub fun(ByRef a As Integer)' for interface 'A'.
+
+REM LineNo: 20
+REM ExpectedError: BC30401
+REM ErrorMessage: 'Cfun' cannot implement 'fun' because there is no matching sub on interface 'A'.
+
+Interface A
+ Sub fun(ByRef a As Integer)
+End Interface
+
+Class B
+ Implements A
+ Sub Cfun(ByVal a As Integer) Implements A.fun
+ End Sub
+End Class
+
+Module InterfaceI
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30149
+REM ErrorMessage: 'B' must implement 'Sub fun([a As Integer = 10])' for interface 'A'.
+
+REM LineNo: 20
+REM ExpectedError: BC30401
+REM ErrorMessage: 'Cfun' cannot implement 'fun' because there is no matching sub on interface 'A'.
+
+Interface A
+ Sub fun(ByVal Optional a As Integer=10)
+End Interface
+
+Class B
+ Implements A
+ Sub Cfun(ByVal Optional a As Integer=20) Implements A.fun
+ End Sub
+End Class
+
+Module InterfaceI
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30149
+REM ErrorMessage: 'B' must implement 'Sub fun(ParamArray a() As Integer)' for interface 'A'.
+
+REM LineNo: 20
+REM ExpectedError: BC30401
+REM ErrorMessage: 'Cfun' cannot implement 'fun' because there is no matching sub on interface 'A'.
+
+Interface A
+ Sub fun(ByVal Paramarray a() As Integer)
+End Interface
+
+Class B
+ Implements A
+ Sub Cfun(ByVal a() As Integer) Implements A.fun
+ End Sub
+End Class
+
+Module InterfaceI
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 10
+REM ExpectedError: BC30397
+REM ErrorMessage: 'MustInherit' is not valid on an Interface declaration.
+
+MustInherit Interface A
+ MustOverride Sub fun1()
+End Interface
+
+Interface AB
+ Inherits A
+ Overrides Sub fun1()
+End Interface
+
+Module ShadowE
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 18
+REM ExpectedError: BC30610
+REM ErrorMessage: Class 'AB' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s)Public MustOverride Function fun(a As Integer) As Object.
+
+REM LineNo: 20
+REM ExpectedError: BC30284
+REM ErrorMessage: function 'fun' cannot be declared 'Overrides' because it does not override a function in a base class.
+
+MustInherit Class A
+ MustOverride Function fun(ByVal a As Integer)
+End Class
+
+Class AB
+ Inherits A
+ Overrides Function fun(ByVal a As String)
+ End Function
+End Class
+
+Module MustInheritE
+ Sub Main()
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 24
+REM ExpectedError: BC30456
+REM ErrorMessage: 'C' is not a member of 'A'.
+
+'To check if Importing is done properly... without ambiguity...
+
+Imports A
+
+Namespace A
+ Namespace A
+ Public Module C
+ Public D as Integer=10
+ End Module
+ End Namespace
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ if A.C.D<>10 Then
+ Throw New System.Exception("Namespace Not working")
+ End If
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 18
+REM ExpectedError: BC30179
+REM ErrorMessage: class 'C' and class 'C' conflict in namespace 'B'.
+
+Namespace A
+ Namespace B
+ Class C
+ End Class
+ End Namespace
+End Namespace
+
+Namespace A.B
+ Class C
+ End Class
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 21
+REM ExpectedError: BC30560
+REM ErrorMessage: 'Console' is ambiguous in the namespace 'System'
+
+'Thus it can be understood that Shadowing is not possible... even for existing namespaces...
+
+Namespace System
+ Public Module Console
+ Public Sub WriteLine(s as String)
+ End Sub
+ End Module
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ System.Console.WriteLine("HelloWorld")
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 29
+REM ExpectedError: BC30561
+REM ErrorMessage: 'C' is ambiguous, imported from the namespaces or types 'AA, A'.
+
+Imports A
+Imports AA
+
+Namespace A
+ Public Module B
+ Sub C(a as integer)
+ End Sub
+ End Module
+End Namespace
+
+Namespace AA
+ Public Module B
+ Sub C(a as Integer)
+ End Sub
+ End Module
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ C(1)
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 22
+REM ExpectedError: BC30471
+REM ErrorMessage: Expression is not an array or a method, and cannot have an argument list.
+
+'Checking if the type of an unqualified name holds good
+
+Imports A
+
+Namespace A
+ Public Module B
+ Public C as Integer=10
+ End Module
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ If B.C()<>10 Then
+ Throw New System.Exception("Not Working")
+ End If
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 25
+REM ExpectedError: BC30562
+REM ErrorMessage: 'C' is ambiguous between declarations in Modules 'A.B' and 'A.B1'.
+
+Imports A
+
+Namespace A
+ Public Module B
+ Sub C(a as integer)
+ End Sub
+ End Module
+ Public Module B1
+ Sub C(a as integer)
+ End Sub
+ End Module
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ C(1)
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 12
+REM ExpectedError: BC30183
+REM ErrorMessage: Keyword is not valid as an identifier.
+
+'VB.Net Accepts recognizes even keywords as qualifiers as long as they follow a period, but Alias cannot be a keyword
+
+Imports Default = A.B
+
+Namespace A
+ Namespace B
+ Public Module C
+ Public D as Integer=10
+ End Module
+ End Namespace
+End Namespace
+
+Module NamespaceA
+ Sub Main()
+ End Sub
+End Module
+
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 10
+REM ExpectedError: BC30397
+REM ErrorMessage: 'NotInheritable' is not valid on an Interface declaration.
+
+NotInheritable Interface A
+ Sub G()
+End Interface
+
+Module InheritanceN
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 17
+REM ExpectedError: BC30266
+REM ErrorMessage: 'Protected Overrides Sub fun()' cannot override 'Protected Friend Overridable Sub fun()' because they have different access levels.
+
+Class C1
+ Protected Friend Overridable Sub fun()
+ End Sub
+End Class
+
+Class C2
+ Inherits C1
+ Protected Overrides Sub fun()
+ End Sub
+End Class
+
+Module InheritanceM
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 17
+REM ExpectedError: BC30266
+REM ErrorMessage: 'Public Overrides Sub fun([i As Integer = 7])' cannot override 'Public Overridable Sub fun([i As Integer = 9])' because they differ by the default values of optional parameters.
+
+Class C1
+ Public Overridable Sub fun(Optional i As Integer=9)
+ End Sub
+End Class
+
+Class C2
+ Inherits C1
+ Public Overrides Sub fun(Optional i As Integer=7)
+ End Sub
+End Class
+
+Module InheritanceM
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 11
+REM ExpectedError: BC30270
+REM ErrorMessage: 'Overridable' is not valid on an interface method declaration.
+
+Interface C1
+ Overridable Function fun()
+End Interface
+
+Interface C2
+ Inherits C1
+ Overrides Function fun()
+End Interface
+
+Module InheritanceM
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 22
+REM ExpectedError: BC30398
+REM ErrorMessage: 'Public Overrides Sub fun1(ByRef i As Integer)' cannot override 'Public Overridable Sub fun1(i As Integer)' because they differ by a parameter that is marked as 'ByRef' versus 'ByVal'.
+
+Class A
+ Public Overridable Sub fun(i As Integer)
+ End Sub
+ Public Overridable Sub fun1(i As Integer)
+ End Sub
+End Class
+
+Class B
+ Inherits A
+ Public Overrides Sub fun(ByVal i As Integer)
+ End Sub
+ Public Overrides Sub fun1(ByRef i As Integer)
+ End Sub
+End Class
+
+Module Default1
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 17
+REM ExpectedWarning: BC40005
+REM WarningMessage: sub 'fun' shadows an overridable method in a base class. To override the base method, this method must be declared 'Overrides'.
+
+Class C1
+ Public Overridable Sub fun()
+ End Sub
+End Class
+
+Class C2
+ Inherits C1
+ Public Overridable Sub fun()
+ End Sub
+End Class
+
+Module Default1
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 17
+REM ExpectedWarning: BC40003
+REM WarningMessage: sub 'fun' shadows an overloadable member declared in the base class 'C1'. If you want to overload the base method, this method must be declared 'Overloads'.
+
+Class C1
+ Public Overridable Sub fun()
+ End Sub
+End Class
+
+Class C2
+ Inherits C1
+ Public Overridable Sub fun(i as Integer)
+ End Sub
+End Class
+
+Module Default1
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 17
+REM ExpectedError: BC30268
+REM ErrorMessage: 'Public Overrides Sub fun()' cannot override 'Public Shared Sub fun()' because it is declared 'Shared'.
+
+Class C1
+ Public Shared Sub fun()
+ End Sub
+End Class
+
+Class C2
+ Inherits C1
+ Public Overrides Sub fun()
+ End Sub
+End Class
+
+Module InheritanceM
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30469
+REM ErrorMessage: Reference to a non-shared member requires an object reference.
+
+Class A
+ Private Sub fun(i as Integer)
+ System.Console.WriteLine("Outer Integer {0}",i)
+ End Sub
+ Shared Sub fun(i as String)
+ System.Console.WriteLine("Outer String {0}",i)
+ End Sub
+ Class AB
+ Sub gun()
+ fun(1)
+ fun("Hello")
+ End Sub
+ End Class
+End Class
+
+Module ScopeA
+ Sub Main()
+ Dim a as A.AB=new A.AB()
+ a.gun()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 23
+REM ExpectedError: BC30469
+REM ErrorMessage: Reference to a non-shared member requires an object reference.
+
+REM LineNo: 24
+REM ExpectedError: BC30469
+REM ErrorMessage: Reference to a non-shared member requires an object reference.
+
+Class A
+ Sub fun(i as Integer)
+ System.Console.WriteLine("Outer Integer {0}",i)
+ End Sub
+ Sub fun(i as String)
+ System.Console.WriteLine("Outer String {0}",i)
+ End Sub
+ Class AB
+ Sub gun()
+ fun(1) 'Only Shared functions can be accessed by inner class... error
+ fun("Hello") 'Only Shared functions can be accessed by inner class... error
+ End Sub
+ End Class
+End Class
+
+Module ScopeA
+ Sub Main()
+ Dim a as A.AB=new A.AB()
+ a.gun()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 32
+REM ExpectedError: BC30685
+REM ErrorMessage: 'fun' is ambiguous across the inherited interfaces 'AB' and 'AC'.
+
+'This program is used to check the functioning of Shadows
+
+Interface A
+ Sub fun(ByVal i As Integer)
+End Interface
+
+Interface AB
+ Inherits A
+ Shadows Sub fun(ByVal i As Integer)
+End Interface
+
+Interface AC
+ Inherits A
+ Shadows Sub fun(ByVal i As Integer)
+End Interface
+
+Interface ABS
+ Inherits AB, AC
+End Interface
+
+Class Test
+ Sub D(ByVal d As ABS)
+ d.fun(2)
+ CType(d, A).fun(2)
+ CType(d, AB).fun(2)
+ CType(d, AC).fun(2)
+ End Sub
+End Class
+
+Module InheritanceO
+ Sub Main()
+ Dim a as Test=new Test()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 28
+REM ExpectedError: BC30516
+REM ErrorMessage: Overload resolution failed because no accessible 'fun' accepts this number of arguments.
+
+'This program is used to check the functioning of Shadows
+
+Class A
+ Public Sub fun()
+ End Sub
+End Class
+
+Class AB
+ Inherits A
+ Public Shadows Sub fun(ByVal i As Integer)
+ End Sub
+ Private Shadows Sub fun()
+ End Sub
+End Class
+
+Class AC
+ Inherits AB
+ Sub fun1()
+ fun()
+ End Sub
+End Class
+
+Module ShadowG
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 24
+REM ExpectedError: BC30149
+REM ErrorMessage: 'C' must implement 'Sub F()' for interface 'A'.
+
+'Check the working of the Inheritable interfaces
+'Note that though Shadowing is done... error occurs because there is no implementation for A.F
+
+Interface A
+ Sub F()
+End Interface
+
+Interface B
+ Inherits A
+ Shadows Sub F()
+ Sub G()
+End Interface
+
+Class C
+ Implements B
+ Sub CF() Implements B.F
+ End Sub
+ Sub CG() Implements B.G
+ End Sub
+End Class
+
+Module InheritanceQ
+ Sub Main()
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 16
+REM ExpectedError: BC32006
+REM ErrorMessage: 'Char' values cannot be converted to 'Integer'. Use Microsoft.VisualBasic.AscW' to interpret a character as a Unicode value or 'Microsoft.VisualBasic.Val' to interpret it as a digit.
+
+Imports System
+
+Module Default1
+ Sub Main()
+ Dim a As Integer
+ Dim c as char
+ a=c
+ End Sub
+End Module
--- /dev/null
+'Author:
+' V. Sudharsan (vsudharsan@novell.com)
+'
+' (C) 2003 Ximian, Inc.
+
+REM LineNo: 19
+REM ExpectedError: BC30203
+REM ErrorMessage: Identifier expected.
+
+REM LineNo: 20
+REM ExpectedError: BC30205
+REM ErrorMessage: End of statement expected.
+
+Imports System
+
+Module Default1
+ Sub Main()
+ Dim _1, _a, a, a1 As Integer 'These are the correct for of declarations
+ Dim 1aa, *aa As Integer ' These are wrong
+ Dim aa3.3 As Integer ' This is wrong
+ End Sub
+End Module