-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-patternsImplementation of patterns in analyzer/cfeImplementation of patterns in analyzer/cfestatus-pending
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>
...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-patternsImplementation of patterns in analyzer/cfeImplementation of patterns in analyzer/cfestatus-pending