Closed
Description
This program passes strong mode because the LUB of the arms of the ternary operator is Object
, which is allowed to be downcast to int
. If we disallow implicit downcasts we'd catch this, but even in the absence of this I think we could do better. In a typed context, we should always check the arms of the ternary operator against the type from the context.
void main() {
bool b;
int test = b ? "123" : 123;
}