dotnet / dotnet/vblang

[Proposal] TypeOf over multiple types.

Open
#23 23 comments 0 reactions 0 assignees View on GitHub
Discussion
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

[(Ported from Roslyn Repo)
](https://github.com/dotnet/roslyn/issues/15458)

`TypeOf ... IsNot ..`
```vb.net
If TypeOf obj IsNot TypeA AndAlso
TypeOf obj IsNot TypeB Then
```

```vb.net
If TypeOf obj IsNot {TypeA, TypeB} Then
```
`TypeOf ... Is ...`
```vb.net
If TypeOf obj Is TypeA OrElse
TypeOf obj Is TypeB Then
```

```vb.net
If TypeOf obj Is {TypeA, TypeB} Then
```

**Grammar**
```BNF
TypeOf_Obj ::= "TypeOf" ws+ identifier
TypeOf_IsExpr ::= TypeOf_Obj ws+ "Is" ws+ MatchAgaist
TypeOf_IsNotExpr ::= TypeOf_Obj ws+ "IsNot" ws+ MatchAgainst
MatchAgainst ::= Single | MultipleTypes
SingleType ::= typeIdentifier
MultipleTypes ::= '{' typeIdentifier (ws* ',' ws* typeIdentifier)+ ws* '}'
```

Ruled out `TypeOf obj Is ( Type0, Type1. Type2 )` as that conflicts with tuple literal syntax.

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.