Open
Description
Hello, again 😃
Consider:
void main() {
if (() {} case Function()) {
print("foo");
}
}
On DartPad, it prints foo
and terminates successfully. However, it looks like the spec does not intend for that to be possible. Function
is not a typeIdentifier so objectPatterns do not describe Function()
and there's no other pattern that explicitly introduces Function patterns.
=== Analyzer ===
Scan errors: 0
Parse errors: 0
...
┃ ┣━ <CaseClauseImpl> [26-41]
┃ ┃ ┣━ 'case' [26-30]
┃ ┃ ┗━ <GuardedPatternImpl> [31-41]
┃ ┃ ┗━ <ObjectPatternImpl> [31-41]
┃ ┃ ┣━ <NamedTypeImpl> [31-39]
┃ ┃ ┃ ┗━ 'Function' [31-39]
┃ ┃ ┣━ '(' [39-40]
┃ ┃ ┗━ ')' [40-41]
...
--------------------------------------------------------------------------------
=== ANTLR ===
line 2:17 missing ')' at 'Function'
Errors of type 1: [[@15,41:41=')',<7>,2:27], [@15,41:41=')',<7>,2:27], [@15,41:41=')',<7>,2:27], [@15,41:41=')',<7>,2:27]]
Errors of type 2: [<missing ')'>, Function, (, ), )]
line 2:17 missing ')' at 'Function'
<startSymbol>
┗━ <libraryDefinition>
┣━ <metadata>
...