Hah! Yes, good catch. Let me think about this one. Thanks, Gavin
> On 30 Apr 2018, at 17:13, Éamonn McManus <emcma...@google.com> wrote: > > I believe the grammar is ambiguous regarding `->`. If you have > case a -> b -> c > then in principle it could mean (1) when the selector expression equals `a` > the value is `b -> c`, or (2) when the selector expression equals `a -> b` > the value is `c`. Of course (2) is excluded semantically but I think it > could be excluded syntactically just by changing the definition of > ConstantExpression from > > ConstantExpression: > Expression > > to > > ConstantExpression: > AssignmentExpression > > On Fri, 27 Apr 2018 at 08:14, Gavin Bierman <gavin.bier...@oracle.com> > wrote: > >> I have uploaded the latest draft of the spec for JEP 325 at > http://cr.openjdk.java.net/~gbierman/switch-expressions.html > >> Changes from the last version: >> * Supports new -> label form in both switch expressions and switch > statements >> * Added typing rules for switch expression >> * Restrict the type of a selector expression to not include long, double > and float as previously proposed >> * Misc smaller changes from community feedback (thanks!) > >> Comments welcomed! >> Gavin > >>> On 12 Apr 2018, at 22:27, Gavin Bierman <gavin.bier...@oracle.com> > wrote: >>> >>> I have uploaded a draft spec for JEP 325: Switch expressions at > http://cr.openjdk.java.net/~gbierman/switch-expressions.html >>> >>> Note there are still three things missing: >>> >>> * There is no text about typing a switch expression, as this is still > being discussed on this list. >>> * There is no name given for the exception raised at runtime when a > switch expression fails to find a matching pattern label, as this is still > being discussed on this list. >>> * The spec currently permits fall through from a "case pattern:” > statement group into a "case pattern ->" clause. We are still working > through the consequences of removing this possibility. >>> >>> Comments welcomed! >>> Gavin