Reporting of pattern variable redefinition
Jayaprakash Artanareeswaran
jay.a at outlook.in
Wed Jan 27 13:58:02 UTC 2021
Hello,
I am looking at the following code and wondering why Javac (from JDK 16, ea33) reports an error on the first line and not on the second:
boolean b1 = (o instanceof String a) ? false : (o instanceof String a); // Error
boolean b2 = (o instanceof String a) ? false : ((o instanceof String a) ? false : true); // No error
Is reporting the first case required as the pattern variable "a" is not in scope in the false arm of the conditional expression anyway?
Regards,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210127/3bcf30a2/attachment.htm>
More information about the compiler-dev
mailing list