Pattern Matching for switch (Second Preview)

Gavin Bierman gavin.bierman at oracle.com
Fri Oct 8 13:07:06 UTC 2021



> On 22 Sep 2021, at 21:37, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> And i think we should also fix the following
> 
> 5. add an partial order edge between a guarded pattern and a constant of a subtypes of the type of the guarded pattern
>   This code currently compiles
>    switch(value) {
>      case Integer i && bar() -> {}
>      case 3 -> {}
>      case Integer i -> {}
>    }
> 
>   but i think it should be written
>    switch(value) {
>      case 3 -> {}
>      case Integer i && bar() -> {}
>      case Integer i -> {}
>    }
> 
>   so the code is easier to read. 


Agreed. I’ll make this change. 


More information about the amber-dev mailing list