Closed
Description
This is excerpt from language/patterns/guard_error_test
.
Object f() {
return switch (false) {
var x when (){ return true; }() => x,
_ => false,
};
}
This reports
Found but did not expect:
ParserErrorCode.EXPECTED_TOKEN [56, 1, "Expected to find '=>'."]
ParserErrorCode.UNEXPECTED_TOKEN [58, 6, "Unexpected text 'return'.", "Try removing the text."]
ParserErrorCode.EXPECTED_TOKEN [69, 1, "Expected to find '}'."]
ParserErrorCode.EXPECTED_TOKEN [75, 2, "Expected to find '}'."]
CompileTimeErrorCode.NON_BOOL_CONDITION [54, 2, "Conditions must have a static type of 'bool'.", "Try changing the condition."]
CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION [56, 16, "The expression doesn't evaluate to a function, so it can't be invoked."]
CompileTimeErrorCode.NON_EXHAUSTIVE_SWITCH [22, 6, "The type 'bool' is not exhaustively matched by the switch cases.", "Try adding a default case or cases that match true."]
HintCode.UNUSED_LOCAL_VARIABLE [47, 1, "The value of the local variable 'x' isn't used.", "Try removing the variable or using it."]