[ 
https://issues.apache.org/jira/browse/GROOVY-11229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17791627#comment-17791627
 ] 

Eric Milles commented on GROOVY-11229:
--------------------------------------

For the Java 16 pattern, could you just create a VariableExpression (like what 
is in a DeclarationExpression) for “x instanceof Type y” instead of a 
ClassExpression?  

Then for Java 21 record pattern, what AST gets created for our 
“Type[name:value]” constructor call variant?  Maybe this could be used or maybe 
you need the new node type PatternExpression like you have shown. 

But the example “o instanceof Point(int x, int y) p” does not look right. There 
was no “p” variable in examples I have seen. 

> Support pattern matching for `instanceof`
> -----------------------------------------
>
>                 Key: GROOVY-11229
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11229
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Daniel Sun
>            Priority: Major
>
> See also https://openjdk.org/jeps/394



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to