Dart code generater generates type errors for dart3 which can easy fixed
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
I tried to build a dart package to parse Prisma Orm file. But this problems happens also on your hello grammar file:
```
// Define a grammar called Hello
grammar Hello;
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
```
```
antlr4 -Dlanguage=Dart Hello.g4 -o lib/hello
```
Used versions
ANTLR Parser Generator Version 4.13.1
Dart SDK version: 3.1.3 (stable) (Tue Sep 26 14:25:13 2023 +0000) on "macos_arm64"
The HelloParser.dart file contains a lot of warnings and an some error:
The argument type 'dynamic' can't be assigned to the parameter type 'ParserRuleContext'.
dynamic _localctx = HelloFileContext(context, state);
this can be fixed by generating:
final _localctx = HelloFileContext(context, state);
Contributor guide
Research direction
Run the supplied antlr4 command against the Hello grammar and inspect the generated lib/hello/HelloParser.dart around the dynamic _localctx declaration. Confirm the generated parser under Dart 3.1.3, then verify that the output no longer produces the reported type error and warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100