]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(java): Exclude lambda expressions from _when_ _switch-case_ label clauses...
authorAliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Sun, 9 Jun 2024 16:39:52 +0000 (19:39 +0300)
committerGitHub <noreply@github.com>
Sun, 9 Jun 2024 16:39:52 +0000 (18:39 +0200)
These guard clauses are always boolean expressions, whereas
lambda expressions can only appear in either an assignment,
a casting, or an invocation context.

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-14.11.1
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.27

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/syntax/java.vim
runtime/syntax/testdir/dumps/java_lambda_expressions_00.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_01.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_02.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_03.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_04.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_05.dump
runtime/syntax/testdir/dumps/java_lambda_expressions_06.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_lambda_expressions_07.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_lambda_expressions_08.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_lambda_expressions_99.dump
runtime/syntax/testdir/input/java_lambda_expressions.java

index 5ba724d24e2a67da7cc474b68dfcdc24b410cd24..f5910a8557e630208fc3bb8c436888ebf40ef534 100644 (file)
@@ -3,7 +3,7 @@
 " Maintainer:          Aliaksei Budavei <0x000c70 AT gmail DOT com>
 " Former Maintainer:   Claudio Fleiner <claudio@fleiner.com>
 " Repository:          https://github.com/zzzyxwvut/java-vim.git
-" Last Change:         2024 May 30
+" Last Change:         2024 Jun 08
 
 " Please check :help java.vim for comments on some of the options available.
 
@@ -215,7 +215,7 @@ syn keyword javaLabelVarType        contained var
 syn keyword javaLabelCastType  contained char byte short int
 " Allow for the contingency of the enclosing region not being able to
 " _keep_ its _end_, e.g. case ':':.
-syn region  javaLabelWhenClause        contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal
+syn region  javaLabelWhenClause        contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal,javaLambdaDef
 syn match   javaLabelNumber    contained "\<0\>[lL]\@!"
 syn match   javaLabelNumber    contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)\>[lL]\@!"
 hi def link javaLabelDefault   javaLabel
index eb136e6927b93c6c451a56f3ac8214cc821835ce..9998ce6082de1318f5f085a3b844b1ecb47f646b 100644 (file)
@@ -4,8 +4,9 @@
 |i+0#e000e06&|m|p|o|r|t| +0#0000000&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|E|l|e|m|e|n|t|T|y|p|e|;| @34
 |i+0#e000e06&|m|p|o|r|t| +0#0000000&|j|a|v|a|.|u|t|i|l|.|f|u|n|c|t|i|o|n|.|B|i|n|a|r|y|O|p|e|r|a|t|o|r|;| @33
 |i+0#e000e06&|m|p|o|r|t| +0#0000000&|j|a|v|a|.|u|t|i|l|.|f|u|n|c|t|i|o|n|.|F|u|n|c|t|i|o|n|;| @39
+|i+0#e000e06&|m|p|o|r|t| +0#0000000&|j|a|v|a|.|u|t|i|l|.|f|u|n|c|t|i|o|n|.|P|r|e|d|i|c|a|t|e|;| @38
 @75
-|c+0#00e0003&|l|a|s@1| +0#0000000&|L|a|m|b|d|a|E|x|p|r|e|s@1|i|o|n|s|T|e|s|t|s| @46
+|c+0#00e0003&|l|a|s@1| +0#0000000&|L|a|m|b|d|a|E|x|p|r|e|s@1|i|o|n|s|T|e|s|t|s| @3|/+0#0000e05&@1| |J|D|K| |2|1|+|.| +0#0000000&@31
 |{+0#00e0e07&| +0#0000000&@73
 | +0#00e0e07&@3|<|I|1|,| |C|1|,| |C|2|,| |T|1|,| |T|2|,| |T|3|,| |Z|1|,| |Z|2|,| |Z|3|,| |S|1|,| |S|2|,| |S|3|>| |v+0#00e0003&|o|i|d| +0#00e0e07&|t|e|s|t|(|)| +0#0000000&@10
 @4|{+0#00e0e07&| +0#0000000&@2|/+0#0000e05&@1| |S|c|h|ö|n|f|i|n|k|e|l|'|s| |f|u|n|c|t|i|o|n|s|.| +0#0000000&@39
@@ -16,5 +17,4 @@
 @8|S|<|S|1|,| |S|2|,| |S|3|>| |s| |=| |f+0#00e0e07&| |-|>| +0#0000000&|g+0#00e0e07&| |-|>| +0#0000000&|x+0#00e0e07&| |-|>| +0#0000000&|f|.|a|p@1|l|y|(|x|)| @23
 @24|.|a|p@1|l|y|(|g|.|a|p@1|l|y|(|x|)@1|;| @31
 @75
-@8|I|<|I|1|>| |i|0|1| |=| |(+0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @41
 @57|1|,|1| @10|T|o|p| 
index 53bb657d05523fbf42d914a69480fa9fa91df941..4753266d5d38c15819126ca352cd3bde77400fc9 100644 (file)
@@ -1,9 +1,10 @@
-| +0&#ffffff0@7|T|<|T|1|,| |T|2|,| |T|3|>| |t| |=| |f+0#00e0e07&| |-|>| +0#0000000&|y+0#00e0e07&| |-|>| +0#0000000&|x+0#00e0e07&| |-|>| +0#0000000&|f|.|a|p@1|l|y|(|x|)|.|a|p@1|l|y|(|y|)|;| @13
+| +0&#ffffff0@7|C|<|C|1|,| |C|2|>| |c| |=| |x+0#00e0e07&| |-|>| +0#0000000&|y+0#00e0e07&| |-|>| +0#0000000&|x|;| @40
+@8|T|<|T|1|,| |T|2|,| |T|3|>| |t| |=| |f+0#00e0e07&| |-|>| +0#0000000&|y+0#00e0e07&| |-|>| +0#0000000&|x+0#00e0e07&| |-|>| +0#0000000&|f|.|a|p@1|l|y|(|x|)|.|a|p@1|l|y|(|y|)|;| @13
 @8|Z|<|Z|1|,| |Z|2|,| |Z|3|>| |z| |=| |f+0#00e0e07&| |-|>| +0#0000000&|g+0#00e0e07&| |-|>| +0#0000000&|x+0#00e0e07&| |-|>| +0#0000000&|f|.|a|p@1|l|y|(|g|.|a|p@1|l|y|(|x|)@1|;| @13
 @8|S|<|S|1|,| |S|2|,| |S|3|>| |s| |=| |f+0#00e0e07&| |-|>| +0#0000000&|g+0#00e0e07&| |-|>| +0#0000000&|x+0#00e0e07&| |-|>| +0#0000000&|f|.|a|p@1|l|y|(|x|)| @23
 @24|.|a|p@1|l|y|(|g|.|a|p@1|l|y|(|x|)@1|;| @31
-@75
-@8>I|<|I|1|>| |i|0|1| |=| |(+0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @41
+> @74
+@8|I|<|I|1|>| |i|0|1| |=| |(+0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @41
 @8|I|<|I|1|>| |i|0|2| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @31
 @8|I|<|I|1|>| |i|0|3| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @21
 @8|I|<|I|1|>| |i|0|4| |=| |(+0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|)| |-|>| +0#0000000&|x|;| @35
@@ -16,5 +17,4 @@
 @8|I|<|I|1|>| |i|1@1| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| @26
 @8|I|<|I|1|>| |i|1|2| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| @16
 @75
-@8|I|<|I|1|[|]|>| |i@1|0|1| |=| |(+0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @36
-@57|1|9|,|3|-|9| @7|1|5|%| 
+@57|1|9|,|0|-|1| @8|9|%| 
index 6fe6bb2b53cfcaccebf1b3823221664bc183e7cb..258e3c0f7aaf2b83fd3ebc7cbcf099aa73056d60 100644 (file)
@@ -1,9 +1,10 @@
-| +0&#ffffff0@7|I|<|I|1|[|]|>| |i@1|0|1| |=| |(+0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @36
+| +0&#ffffff0@74
+@8|I|<|I|1|[|]|>| |i@1|0|1| |=| |(+0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @36
 @8|I|<|I|1|[|]|>| |i@1|0|2| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @26
 @8|I|<|I|1|[|]|>| |i@1|0|3| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @16
 @8|I|<|I|1|[|]|>| |i@1|0|4| |=| |(+0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @30
-@8|I|<|I|1|[|]|>| |i@1|0|5| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @20
-@8>I|<|I|1|[|]|>| |i@1|0|6| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @10
+@8>I|<|I|1|[|]|>| |i@1|0|5| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @20
+@8|I|<|I|1|[|]|>| |i@1|0|6| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1|.@2| |x|)| |-|>| +0#0000000&|x|;| @10
 @75
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|1| |=| |(+0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|,| |v+0#af5f00255&|a|r| +0#00e0e07&|y|)| |-|>| +0#0000000&|x|;| @13
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|2| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|,| +0#0000000&@16
@@ -16,5 +17,4 @@
 | +0#00e0e07&@19|v+0#af5f00255&|a|r| +0#00e0e07&|x|,| |@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|y|)| |-|>| +0#0000000&|x|;| @19
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|6| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#0000000&@23
 | +0#00e0e07&@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|,| +0#0000000&@32
-| +0#00e0e07&@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#0000000&@45
-@57|3|7|,|3|-|9| @7|3|6|%| 
+@57|3|7|,|3|-|9| @7|2@1|%| 
index e98b3b1e9c9b45f7863872fa48edf85f5deb4a1f..fb0366281d45c843bdbc1afbd5ca252072dc05d1 100644 (file)
@@ -1,9 +1,10 @@
-| +0#00e0e07#ffffff0@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#0000000&@45
+| +0#00e0e07#ffffff0@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|x|,| +0#0000000&@32
+| +0#00e0e07&@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#0000000&@45
 | +0#00e0e07&@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|v+0#af5f00255&|a|r| +0#00e0e07&|y|)| |-|>| +0#0000000&|x|;| @26
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|7| |=| |(+0#00e0e07&|I|1| |x|,| |I|1| |y|)| |-|>| +0#0000000&|x|;| @15
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|8| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |x|,| +0#0000000&@17
-| +0#00e0e07&@19|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |y|)| |-|>| +0#0000000&|x|;| @33
-@8>B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|9| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| +0#0000000&@10
+| +0#00e0e07&@19>@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |y|)| |-|>| +0#0000000&|x|;| @33
+@8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|0|9| |=| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| +0#0000000&@10
 | +0#00e0e07&@19|x|,| |@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |y|)| |-|>| +0#0000000&|x|;| @20
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t|1|0| |=| |(+0#00e0e07&|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1| |x|,| +0#0000000&@21
 | +0#00e0e07&@19|f+0#4040ff13&|i|n|a|l| +0#00e0e07&|I|1| |y|)| |-|>| +0#0000000&|x|;| @37
@@ -16,5 +17,4 @@
 @75
 @8|R|u|n@1|a|b|l|e| |n|o|O|p| |=| |(+0#00e0e07&|)| |-|>| +0#0000000&|{+0#00e0e07&|}|;+0#0000000&| @41
 @8|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t| |=| |(+0#00e0e07&|x|,| |y|)| |-|>| +0#0000000&|x|;| @23
-@8|I|<|I|1|>| |i|d|1| |=| |(+0#00e0e07&|x|)| |-|>| +0#0000000&|(|x|)|;| @43
-@57|5@1|,|3|-|9| @7|5|7|%| 
+@57|5@1|,|6|-|2|1| @6|3|6|%| 
index 470f9463a9e8300307e40781b252ed1c7e17ec89..d5b1262fd47b56f812ee640a465d7705f8d0c485 100644 (file)
@@ -1,9 +1,10 @@
-| +0&#ffffff0@7|I|<|I|1|>| |i|d|1| |=| |(+0#00e0e07&|x|)| |-|>| +0#0000000&|(|x|)|;| @43
+| +0&#ffffff0@7|B|i|n|a|r|y|O|p|e|r|a|t|o|r|<|I|1|>| |l|e|f|t|C|o|n|s|t| |=| |(+0#00e0e07&|x|,| |y|)| |-|>| +0#0000000&|x|;| @23
+@8|I|<|I|1|>| |i|d|1| |=| |(+0#00e0e07&|x|)| |-|>| +0#0000000&|(|x|)|;| @43
 @8|@+0#e000e06&|S|u|p@1|r|e|s@1|W|a|r|n|i|n|g|s|(+0#0000000&|"+0#e000002&|u|n|c|h|e|c|k|e|d|"|)+0#0000000&| |I|<|I|1|>| |i|d|2| |=| @24
 @16|(@1|I|<|I|<|I|1|>@1|)| |(|I|<|?|>|)| |(|F|u|n|c|t|i|o|n|<|I|1|,| @26
 @20|I|1|>| |x|)| |-|>| |x|)|.|a|p@1|l|y|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|0+0#e000002&|)+0#0000000&| |{+0#00e0e07&| +0#0000000&@23
-@16|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|i+0#00e0003&|n|t|)+0#0000000&| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|)+0#0000000&| |-|>| |(+0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| @21
-@16>d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&|-|>| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| |}+0#00e0e07&|)+0#0000000&|;| @21
+@16>c+0#af5f00255&|a|s|e| +0#0000000&|(@1|i+0#00e0003&|n|t|)+0#0000000&| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|)+0#0000000&| |-|>| |(+0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| @21
+@16|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&|-|>| |(+0#00e0e07&|@+0#e000e06&|T|a|g@1|a|b|l|e| +0#00e0e07&|I|1| |x|)| |-|>| +0#0000000&|x|;| |}+0#00e0e07&|)+0#0000000&|;| @21
 @8|C|<|C|1|,| |C|2|>| |c|o|n|s|t|1| |=| |(+0#00e0e07&|x|)| |-|>| +0#0000000&|(+0#00e0e07&|y|)| |-|>| +0#0000000&|(|x|)|;| @29
 @8|C|<|C|1|,| |C|2|>| |c|o|n|s|t|2| |=| |s+0#af5f00255&|w|i|t|c|h|(+0#0000000&|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|"+0#e000002&@1|)+0#0000000&| |{+0#00e0e07&| +0#0000000&@27
 @24|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|-|>|"|-+0#0000000&|>|"+0#e000002&|(|s|)|-|>|(|s|)|"|;+0#0000000&| @28
@@ -16,5 +17,4 @@
 @75
 @4|@+0#e000e06&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|T|a|r|g|e|t|(+0#0000000&|E|l|e|m|e|n|t|T|y|p|e|.|P|A|R|A|M|E|T|E|R|)| @19
 @4|@+0#e000e06&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|R|e|p|e|a|t|a|b|l|e|(+0#0000000&|T|a|g@1|a|b|l|e|s|.|c+0#00e0003&|l|a|s@1|)+0#0000000&| @21
-@4|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e| |{+0#00e0e07&| +0#0000000&|S|t|r|i|n|g|[|]| |v|a|l|u|e|(|)| |d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|"+0#e000002&@1|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@18
-@57|7|3|,|5|-|1|7| @6|7|8|%| 
+@57|7|3|,|5|-|1|7| @6|4|9|%| 
index fe5415d4fb1189971f6693abbbc740f783c5d881..496d4c591ba503e05c4016c8432760c27733912f 100644 (file)
@@ -1,9 +1,10 @@
-| +0&#ffffff0@3|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e| |{+0#00e0e07&| +0#0000000&|S|t|r|i|n|g|[|]| |v|a|l|u|e|(|)| |d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|"+0#e000002&@1|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@18
+| +0&#ffffff0@3|@+0#e000e06&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|R|e|p|e|a|t|a|b|l|e|(+0#0000000&|T|a|g@1|a|b|l|e|s|.|c+0#00e0003&|l|a|s@1|)+0#0000000&| @21
+@4|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e| |{+0#00e0e07&| +0#0000000&|S|t|r|i|n|g|[|]| |v|a|l|u|e|(|)| |d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|"+0#e000002&@1|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@18
 @75
 @4|@+0#e000e06&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|T|a|r|g|e|t|(+0#0000000&|E|l|e|m|e|n|t|T|y|p|e|.|P|A|R|A|M|E|T|E|R|)| @19
 @4|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e|s| |{+0#00e0e07&| +0#0000000&|T|a|g@1|a|b|l|e|[|]| |v|a|l|u|e|(|)|;| |}+0#00e0e07&| +0#0000000&@26
-@75
-@4>i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|I|<|A|1|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|A|1|,| |A|1|>| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@26
+> @74
+@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|I|<|A|1|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|A|1|,| |A|1|>| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@26
 @4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|C|<|A|1|,| |A|2|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|1|>@1| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@8
 @4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|T|<|A|1|,| |A|2|,| |A|3|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&@39
 @16|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|3|>@1|,| @18
@@ -16,5 +17,4 @@
 @16|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|3|>@1|,| @18
 @20|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |A|2|>|,| @28
 @20|F|u|n|c|t|i|o|n|<|A|1|,| |A|3|>@2| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@32
-|}+0#00e0e07&| +0#0000000&@73
-@57|9|1|,|2|-|5| @7|B|o|t| 
+@57|9|1|,|0|-|1| @7|6|2|%| 
diff --git a/runtime/syntax/testdir/dumps/java_lambda_expressions_06.dump b/runtime/syntax/testdir/dumps/java_lambda_expressions_06.dump
new file mode 100644 (file)
index 0000000..588f7d6
--- /dev/null
@@ -0,0 +1,20 @@
+| +0&#ffffff0@19|F|u|n|c|t|i|o|n|<|A|1|,| |A|3|>@2| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@32
+@75
+| +0#00e0e07&@3|s+0#00e0003&|t|a|t|i|c| +0#00e0e07&|v+0#00e0003&|o|i|d| +0#00e0e07&|e|c|h|o|(|O|b|j|e|c|t| |o|)| +0#0000000&|{+0#00e0e07&| +0#0000000&|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|o|)|;| |}+0#00e0e07&| +0#0000000&@17
+@75
+@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{+0#00e0e07&| +0#0000000&@62
+@8>e+0#00e0003&|n|u|m| +0#0000000&|L|e|t@1|e|r|s| |{+0#00e0e07&| +0#0000000&|O|T|H|E|R|,| |A|L|P|H|A|,| |B|E|T|A| |}+0#00e0e07&| +0#0000000&@31
+@75
+@8|L|e|t@1|e|r|s| |o|t|h|e|r| |=| |L|e|t@1|e|r|s|.|O|T|H|E|R|;| @36
+@75
+@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|o|t|h|e|r|)| |{+0#00e0e07&| +0#0000000&@50
+@8|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s| |a|l|p|h|a| |w+0#af5f00255&|h|e|n| +0#0000000&|L|e|t@1|e|r|s|.|A|L|P|H|A| |=@1| |a|l|p|h|a|:| @19
+@24|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|a|l|p|h|a|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@27
+@8|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s| |b|e|t|a| |w+0#af5f00255&|h|e|n| +0#0000000&|L|e|t@1|e|r|s|.|B|E|T|A| |=@1| |b|e|t|a|:| @22
+@24|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|b|e|t|a|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@28
+@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @11|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|o|t|h|e|r|)|;| |}+0#00e0e07&| +0#0000000&@30
+@8|}+0#00e0e07&| +0#0000000&@65
+@75
+@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|o|t|h|e|r|)| |{+0#00e0e07&| +0#0000000&@45
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s| |a|l|p|h|a| |w+0#af5f00255&|h|e|n| +0#0000000&|L|e|t@1|e|r|s|.|A|L|P|H|A| |=@1| |a|l|p|h|a| @16
+@57|1|0|9|,|3|-|9| @6|7|6|%| 
diff --git a/runtime/syntax/testdir/dumps/java_lambda_expressions_07.dump b/runtime/syntax/testdir/dumps/java_lambda_expressions_07.dump
new file mode 100644 (file)
index 0000000..1def6c2
--- /dev/null
@@ -0,0 +1,20 @@
+| +0&#ffffff0@11|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s| |a|l|p|h|a| |w+0#af5f00255&|h|e|n| +0#0000000&|L|e|t@1|e|r|s|.|A|L|P|H|A| |=@1| |a|l|p|h|a| @16
+@24|-|>| |a|l|p|h|a|;| @41
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s| |b|e|t|a| |w+0#af5f00255&|h|e|n| +0#0000000&|L|e|t@1|e|r|s|.|B|E|T|A| |=@1| |b|e|t|a| @19
+@24|-|>| |b|e|t|a|;| @42
+@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@8|-|>| |o|t|h|e|r|;| @37
+@8>}+0#00e0e07&|)+0#0000000&|;| @63
+@75
+@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|n+0#e000002&|u|l@1|)+0#0000000&| |{+0#00e0e07&| +0#0000000&@51
+@8|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r| |w+0#af5f00255&|h|e|n| +0#0000000&|!|"+0#e000002&|<|e|m|p|t|y|>|"|.+0#0000000&|e|q|u|a|l|s|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|s|t|r|)| |{+0#00e0e07&| +0#0000000&@13
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| |w+0#af5f00255&|h|e|n| +0#0000000&@41
+@20|P|r|e|d|i|c|a|t|e|.|<|S|t|r|i|n|g|>|n|o|t|(|t+0#00e0e07&|e|x|t| |-|>| +0#0000000&@25
+@28|!|t|e|x|t|.|i|s|E|m|p|t|y|(|)@1| @30
+@24|.|t|e|s|t|(|s|t|r|_|)| @39
+@28|-|>| |"+0#e000002&|<|e|m|p|t|y|>|"|;+0#0000000&| @33
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| @7|-|>| |s|t|r|_|;| @30
+@12|}+0#00e0e07&|)+0#0000000&|:| @8|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|s|t|r|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@29
+@8|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|:+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @4|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|"+0#e000002&|O|t|h|e|r|"|)+0#0000000&|;| |}+0#00e0e07&| +0#0000000&@24
+@8|}+0#00e0e07&|;+0#0000000&| @64
+@75
+@57|1|2|7|,|3|-|9| @6|8|9|%| 
diff --git a/runtime/syntax/testdir/dumps/java_lambda_expressions_08.dump b/runtime/syntax/testdir/dumps/java_lambda_expressions_08.dump
new file mode 100644 (file)
index 0000000..5d771df
--- /dev/null
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|n+0#e000002&|u|l@1|)+0#0000000&| |{+0#00e0e07&| +0#0000000&@46
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r| |w+0#af5f00255&|h|e|n| +0#0000000&|!|"+0#e000002&|<|e|m|p|t|y|>|"|.+0#0000000&|e|q|u|a|l|s|(| @23
+@28|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|s|t|r|)| |{+0#00e0e07&| +0#0000000&@32
+@16|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| |w+0#af5f00255&|h|e|n| +0#0000000&@37
+@20>P|r|e|d|i|c|a|t|e|.|<|S|t|r|i|n|g|>|n|o|t|(|t+0#00e0e07&|e|x|t| |-|>| +0#0000000&@25
+@28|!|t|e|x|t|.|i|s|E|m|p|t|y|(|)@1| @30
+@24|.|t|e|s|t|(|s|t|r|_|)| @39
+@28|-|>| |"+0#e000002&|<|e|m|p|t|y|>|"|;+0#0000000&| @33
+@16|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| @3|-|>| |s|t|r|_|;| @30
+@16|}+0#00e0e07&|)+0#0000000&| @5|-|>| |s|t|r|;| @43
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|,+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@1|-|>| |"+0#e000002&|O|t|h|e|r|"|;+0#0000000&| @31
+@8|}+0#00e0e07&|)+0#0000000&|;| @63
+@4|}+0#00e0e07&| +0#0000000&@69
+|}+0#00e0e07&| +0#0000000&@73
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|4|5|,|6|-|2|1| @5|B|o|t| 
index 9bc45ebc9d609ee7336359d25f5f6991aeb7fbf0..dc5c104d26864f880d0252ec02ee559a5acc0f29 100644 (file)
@@ -1,20 +1,20 @@
-| +0&#ffffff0@3|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e| |{+0#00e0e07&| +0#0000000&|S|t|r|i|n|g|[|]| |v|a|l|u|e|(|)| |d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|"+0#e000002&@1|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@18
+| +0&#ffffff0@11|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| @7|-|>| |s|t|r|_|;| @30
+@12|}+0#00e0e07&|)+0#0000000&|:| @8|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|s|t|r|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}+0#00e0e07&| +0#0000000&@29
+@8|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|:+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @4|{+0#00e0e07&| +0#0000000&|e|c|h|o|(|"+0#e000002&|O|t|h|e|r|"|)+0#0000000&|;| |}+0#00e0e07&| +0#0000000&@24
+@8|}+0#00e0e07&|;+0#0000000&| @64
 @75
-@4|@+0#e000e06&|j|a|v|a|.|l|a|n|g|.|a|n@1|o|t|a|t|i|o|n|.|T|a|r|g|e|t|(+0#0000000&|E|l|e|m|e|n|t|T|y|p|e|.|P|A|R|A|M|E|T|E|R|)| @19
-@4|@+0#00e0003&|i|n|t|e|r|f|a|c|e| +0#0000000&|T|a|g@1|a|b|l|e|s| |{+0#00e0e07&| +0#0000000&|T|a|g@1|a|b|l|e|[|]| |v|a|l|u|e|(|)|;| |}+0#00e0e07&| +0#0000000&@26
-@75
-@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|I|<|A|1|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|A|1|,| |A|1|>| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@26
-@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|C|<|A|1|,| |A|2|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|1|>@1| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@8
-@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|T|<|A|1|,| |A|2|,| |A|3|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&@39
-@16|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|3|>@1|,| @18
-@20|F|u|n|c|t|i|o|n|<|A|2|,| @42
-@20|F|u|n|c|t|i|o|n|<|A|1|,| |A|3|>@2| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@32
-@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|Z|<|A|1|,| |A|2|,| |A|3|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|2|,| |A|3|>|,| @12
-@20|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |A|2|>|,| @28
-@20|F|u|n|c|t|i|o|n|<|A|1|,| |A|3|>@2| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@32
-@4|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|S|<|A|1|,| |A|2|,| |A|3|>| |e+0#00e0003&|x|t|e|n|d|s| +0#0000000&@39
-@16|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |F|u|n|c|t|i|o|n|<|A|2|,| |A|3|>@1|,| @18
-@20|F|u|n|c|t|i|o|n|<|F|u|n|c|t|i|o|n|<|A|1|,| |A|2|>|,| @28
-@20|F|u|n|c|t|i|o|n|<|A|1|,| |A|3|>@2| |{+0#00e0e07&| +0#0000000&|}+0#00e0e07&| +0#0000000&@32
+@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|n+0#e000002&|u|l@1|)+0#0000000&| |{+0#00e0e07&| +0#0000000&@46
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r| |w+0#af5f00255&|h|e|n| +0#0000000&|!|"+0#e000002&|<|e|m|p|t|y|>|"|.+0#0000000&|e|q|u|a|l|s|(| @23
+@28|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|s|t|r|)| |{+0#00e0e07&| +0#0000000&@32
+@16|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| |w+0#af5f00255&|h|e|n| +0#0000000&@37
+@20|P|r|e|d|i|c|a|t|e|.|<|S|t|r|i|n|g|>|n|o|t|(|t+0#00e0e07&|e|x|t| |-|>| +0#0000000&@25
+@28|!|t|e|x|t|.|i|s|E|m|p|t|y|(|)@1| @30
+@24|.|t|e|s|t|(|s|t|r|_|)| @39
+@28|-|>| |"+0#e000002&|<|e|m|p|t|y|>|"|;+0#0000000&| @33
+@16|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r|_| @3|-|>| |s|t|r|_|;| @30
+@16|}+0#00e0e07&|)+0#0000000&| @5|-|>| |s|t|r|;| @43
+@12|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|,+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@1|-|>| |"+0#e000002&|O|t|h|e|r|"|;+0#0000000&| @31
+@8|}+0#00e0e07&|)+0#0000000&|;| @63
+@4|}+0#00e0e07&| +0#0000000&@69
 >}+0#00e0e07&| +0#0000000&@73
-@57|1|0|4|,|1| @8|B|o|t| 
+@57|1|5|4|,|1| @8|B|o|t| 
index 5c9411e268653eb74da2bab2bb9be22682212119..75f5af4cc882e2135bf0ac367f47ff5f9884d144 100644 (file)
@@ -4,8 +4,9 @@
 import java.lang.annotation.ElementType;
 import java.util.function.BinaryOperator;
 import java.util.function.Function;
+import java.util.function.Predicate;
 
-class LambdaExpressionsTests
+class LambdaExpressionsTests   // JDK 21+.
 {
        <I1, C1, C2, T1, T2, T3, Z1, Z2, Z3, S1, S2, S3> void test()
        {       // Schönfinkel's functions.
@@ -101,4 +102,53 @@ class LambdaExpressionsTests
                                Function<Function<A1, Function<A2, A3>>,
                                        Function<Function<A1, A2>,
                                        Function<A1, A3>>> { }
+
+       static void echo(Object o) { System.out.println(o); }
+
+       static {
+               enum Letters { OTHER, ALPHA, BETA }
+
+               Letters other = Letters.OTHER;
+
+               switch (other) {
+               case Letters alpha when Letters.ALPHA == alpha:
+                                               { echo(alpha); break; }
+               case Letters beta when Letters.BETA == beta:
+                                               { echo(beta); break; }
+               default:                        { echo(other); }
+               }
+
+               echo(switch (other) {
+                       case Letters alpha when Letters.ALPHA == alpha
+                                               -> alpha;
+                       case Letters beta when Letters.BETA == beta
+                                               -> beta;
+                       default                 -> other;
+               });
+
+               switch (null) {
+               case String str when !"<empty>".equals(switch (str) {
+                       case String str_ when
+                                       Predicate.<String>not(text ->
+                                                       !text.isEmpty())
+                                               .test(str_)
+                                                       -> "<empty>";
+                       case String str_                -> str_;
+                       }):                     { echo(str); break; }
+               case null: default:             { echo("Other"); }
+               };
+
+               echo(switch (null) {
+                       case String str when !"<empty>".equals(
+                                                       switch (str) {
+                               case String str_ when
+                                       Predicate.<String>not(text ->
+                                                       !text.isEmpty())
+                                               .test(str_)
+                                                       -> "<empty>";
+                               case String str_        -> str_;
+                               })              -> str;
+                       case null, default      -> "Other";
+               });
+       }
 }