You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paulk-asert (via GitHub)" <gi...@apache.org> on 2026/09/10 12:06:14 UTC

Re: [PR] Reference implementation: structural pattern matching for switch/instanceof (GEP-19 Groovy 7) [groovy]

paulk-asert commented on PR #2655:
URL: https://github.com/apache/groovy/pull/2655#issuecomment-5618404920

   Rebased onto the Groovy 7 master as two commits (the nine phase commits are squashed into the second):
   
   1. `GROOVY-12242` follow-up: pattern variable slots bound in a later `&&`/`||` operand were only initialised at their own `instanceof` site, which fails verification on master for e.g. `p instanceof String s && s.length() > 0 && s.trim() instanceof String t`; and `break`/`continue` now end an if arm for pattern-variable flow scoping. Standalone and cherry-pickable.
   2. The GEP-19 implementation re-lowered onto the first-class `SwitchExpression` of GROOVY-12255: no closure labels or closure-free fast path any more; each pattern arm is a `CaseStatement` with a boolean test label and `if (!(check)) break <arm>` matching steps, bindings via JEP 394 flow scoping (see the updated description). Exhaustiveness follows the existing switch-expression rule (error, not warning). The `fail/SwitchExpression_11x..15x` resources are now `15x..19x`.
   
   Verified with the full core test suite and the lint gate.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org