mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-11 05:59:52 +00:00
8236546: Yield with boolean expression and Object target type crashes javac
The whenTrue and whenFalse sets need to be merged for non-boolean expressions. Reviewed-by: mcimadamore
This commit is contained in:
parent
6fc159f17c
commit
8e2c1c68f6
@ -2579,7 +2579,7 @@ public class Flow {
|
||||
recordExit(exit);
|
||||
return ;
|
||||
} else {
|
||||
scan(tree.value);
|
||||
scanExpr(tree.value);
|
||||
recordExit(new AssignPendingExit(tree, inits, uninits));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8214031 8214114
|
||||
* @bug 8214031 8214114 8236546
|
||||
* @summary Verify switch expressions embedded in various statements work properly.
|
||||
* @compile ExpressionSwitchEmbedding.java
|
||||
* @run main ExpressionSwitchEmbedding
|
||||
@ -321,6 +321,13 @@ public class ExpressionSwitchEmbedding {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
{
|
||||
String s = "";
|
||||
Object o = switch (s) { default -> s != null && s == s; };
|
||||
if (!(Boolean) o) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void throwException() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user