Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Fasta #35177

Closed
lrhn opened this issue Nov 15, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@lrhn
Copy link
Member

commented Nov 15, 2018

This code crashes when run with the VM:

main() {
 dynamic Function() f;
 (f)()<int>();
}

The parentheses around f is needed to trigger the crash, so is the type argument.
The dynamic is not important, replacing it with a correct type like void Function<T>() does not remove the crash.

The stack trace starts with:

Crash when compiling funtest.dart,
at character offset 7:
type 'List<UnresolvedType<KernelTypeBuilder>>' is not a subtype of type 'Arguments' #0      BodyBuilder.handleSend (package:front_end/src/fasta/kernel/body_builder.dart:1162:15)
#1      Parser.parseArgumentOrIndexStar (package:front_end/src/fasta/parser/parser.dart:3947:18)
#2      Parser.parsePrecedenceExpression (package:front_end/src/fasta/parser/parser.dart:3755:21)
#3      Parser.parseExpression (package:front_end/src/fasta/parser/parser.dart:3681:13)
#4      Parser.parseExpressionStatement (package:front_end/src/fasta/parser/parser.dart:3646:13)
#5      Parser.parseExpressionStatementOrDeclarationAfterModifiers (package:front_end/src/fasta/parser/parser.dart:4894:16)
#6      Parser.parseExpressionStatementOrDeclaration (package:front_end/src/fasta/parser/parser.dart:4854:12)
#7      Parser.parseStatementX (package:front_end/src/fasta/parser/parser.dart:3550:14)
#8      Parser.parseStatement (package:front_end/src/fasta/parser/parser.dart:3469:20)
#9      Parser.parseFunctionBody (package:front_end/src/fasta/parser/parser.dart:3374:15)
#10     DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:826:14)
#11     DietListener.endTopLevelMethod (package:front_end/src/fasta/source/diet_listener.dart:303:5)
#12     Parser.parseTopLevelMethod (package:front_end/src/fasta/parser/parser.dart:2289:14)
#13     Parser.parseTopLevelMemberImpl (package:front_end/src/fasta/parser/parser.dart:2190:14)
#14     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:481:14)
@peter-ahe-google

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

I believe this is a bug in the parser. In parseArgumentOrIndexStar we call typeArg.parseArguments after calling parseArguments.

The code in question is supposedly handling this case:

a(b)<T>(c)

However, this example doesn't trigger the above code.

@dart-bot dart-bot closed this in 9677ec9 Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.