It is a error in VB when I declare a Constant of type Some Class = Nothing
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Version Used:
15.6.4
Steps to Reproduce:
```
Imports System
Namespace Test
Friend MustInherit Partial Class ConstantValue
Implements IEquatable(Of ConstantValue)
Public Const NotAvailable As ConstantValue = Nothing
End Class
End Namespace
```
**Expected Behavior**:
No errors when setting NotAvailable to Nothing. This works in C# and the IL allows it. or if I declare in a Module NotAvailable ReadOnly. I would also expect this to work for Structure, and other places it works in C# and is allowed in the IL.
**Actual Behavior**:
BC30424 Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the VB snippet from the issue and inspect how the compiler handles the BC30424 diagnostic for constant declarations. Compare the accepted C# and IL behavior described in the issue, then determine the language-design and compatibility requirements before changing the rule; done means the sample and the related class, structure, and other cases behave as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- visualbasic
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100