Gavin points out another corner case here: when the LHS is the `null`
literal:
if (null instanceof String s) { ... }
Since this is also in the "stupid question" category, it is reasonable
to outlaw it, at least when there's a pattern on the RHS.
I wonder how often this actually occurs in real code....
On 8/26/2020 11:00 AM, Brian Goetz wrote:
Proposed: An `instanceof` expression must be able to evaluate to both
true and false, otherwise it is invalid. This rules out strongly
total patterns on the RHS. If you have a strongly total pattern, use
pattern assignment instead.