paulk-asert commented on code in PR #2922:
URL: https://github.com/apache/groovy/pull/2922#discussion_r3993852986
##########
src/test/groovy/org/codehaus/groovy/classgen/Groovy12255.groovy:
##########
@@ -1045,11 +1045,12 @@ final class Groovy12255 {
@Test
void typeCheckedUnmatchedIsError() {
- // exhaustiveness is a static type-checker error
+ // exhaustiveness is a static type-checker error (in expression
position;
+ // implicit-return position yields null when unmatched, GROOVY-12399)
def err = shouldFail(MultipleCompilationErrorsException, '''
@groovy.transform.TypeChecked
def meth(int a) {
- switch (a) {
+ return switch (a) {
Review Comment:
That is the worrying bit for me. I'll leave a comment below shortly after
some more experimentation. But in the current (with this PR) implementation
only "return" gets the exhaustiveness check.
##########
src/test/groovy/org/codehaus/groovy/classgen/Groovy12255.groovy:
##########
@@ -537,7 +537,7 @@ final class Groovy12255 {
enum Flag { ON, OFF }
String m(Flag f) {
- switch (f) {
+ return switch (f) {
Review Comment:
see above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]