Allow expression is not Type { Prop1: pattern1 } or { Prop2: pattern2 }
(property patterns after not Type or
in pattern matching)
#8323
Unanswered
tats-u
asked this question in
Language Ideas
Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pattern matching allows
expresion is Type { PropOfType1: pattern1 } and not { PropOfType2: pattern2 }
, but doesn't allow its negative formexpresion is Type { PropOfType1: not pattern1 } and not { PropOfType2: not pattern2 }
.We have to write
expresion is not (Type { PropOfType1: pattern1 } and not { PropOfType2: pattern2 })
instead so far.expression is Type { ... } or { ... }
is helpful if you're going to use early-return/continue or throw an exception.This will be transpiled to:
We have to write instead so far:
https://sharplab.io/#v2:EYLgtghglgdgPgAQEwEYCwAoTCDMACAJwFMBjAewIBM8AxMsgClgBc8BBAGjxbwCEueAYQExWAERGsAogEoA3NnzI8gvAG9MeLXlx5g9ADZ4AsgzLAAVqVYBnGes3anCAOx4b3DzDKsGdMngQMNTerGrsIHgoeAC+gcHqfJGheEix8o5aMZk6+PpkRsZIZpbW7vYaGE7Obh5QXj54fvSJbJEoMRlV2tndWrr5hTglViS2FTk17p54Kc0B4W2zjdFxQdThvMmNSJ0KfbE5A4Z4AHIjZXYOB1N1Daz+eBSt26yrTwSJW6mx+069zjyJ1OxXMo3G12q2lc03qyweLUW7V+OV6MSAA==
Beta Was this translation helpful? Give feedback.
All reactions