Closed NolwennD closed 11 months ago
class Example {
int example() {
return switch ("") {
case LongTypeName longVariableName, LongTypeName longVariableName -> 0;
case LongTypeName longVariableName,
LongTypeName longVariableName,
LongTypeName longVariableName -> 0;
case MyRecord(A a), MyRecord(B b) -> 0;
case MyRecord(A a), MyRecord(B b) when true -> 0;
case MyRecord(
LongTypeName longVariableName,
LongTypeName longVariableName
),
MyRecord(
LongTypeName longVariableName,
LongTypeName longVariableName
) -> 0;
};
}
}
It also doesn't support unnamed patterns/variables (_
). I've begun working on those two improvements.
@jtkiesel do you want to take this one (as it seems you already started working on this), or I can take it ?
@clementdessoude I've got it nearly finished, I'll put up a PR shortly.
In JEP 456 a little enhancement will come for
case
label: