Skip to content

[Proposal] TypeOf over multiple types. #23

Open
@AdamSpeight2008

Description

@AdamSpeight2008

(Ported from Roslyn Repo)

TypeOf ... IsNot ..

If TypeOf obj IsNot TypeA AndAlso
   TypeOf obj IsNot TypeB Then
If TypeOf obj IsNot {TypeA, TypeB} Then

TypeOf ... Is ...

If TypeOf obj Is TypeA OrElse
   TypeOf obj Is TypeB Then
If TypeOf obj Is {TypeA, TypeB} Then

Grammar

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions