mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Add basic support for case guards
This commit is contained in:
@@ -82,6 +82,12 @@ class A {
|
||||
case null -> "Null";
|
||||
default -> "Not null";
|
||||
};
|
||||
var whenTest = switch((String)thing) {
|
||||
case "constant" -> "It's constant";
|
||||
case String s when s.length() == 3 -> "It's 3 letters long";
|
||||
case String s when s.length() == 5 -> "it's 5 letters long";
|
||||
default -> "It's something else";
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (RuntimeException rte) {
|
||||
|
||||
Reference in New Issue
Block a user