dotnet / dotnet/vblang

Allow Attributes on Generic Type Parameters

Open
#215 6 comments 1 reaction 0 assignees View on GitHub
Approved-in-Principle Proposal Prototype-Needed
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

It is possible to create an attribute (in VB) that can be used on generic parameter.
```vbnet

Public Class NumericAttribute : Inherits Attribute
Public Sub New()
MyBase.New()
End Sub
End Class
```

Yet consuming that attribute in VB isn't permitted.

```vbnet
Public Structure NRange(Of Tx, Sx)
End Structure
```
produces the following errors on `<`
```
Identifier expected.
'As', comma or ')' expected.
```

We should remedy the issue, and allow them.

-------
Currently syntax node `TypeParameterSyntax` doesn't support them (in C# in does), so will need to extend the definition. Or define another that inherits from `TypeParameterSyntax`.
Parsing should be relatively simple as parsing attributes is already implement, so adding an additional parsing step to parsing of a generic parameters should not be to hard.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.