Skip to content

dart2js: Combination of generic function invocation and Function types not implemented #31572

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

Closed
eernstg opened this issue Dec 7, 2017 · 1 comment
Labels
front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@eernstg
Copy link
Member

eernstg commented Dec 7, 2017

With dart2js (from e299963, 2.0.0-dev.7.0, and probably all versions this year), the following program claims a syntax error:

main() => print(f<String Function(int)>(null));

This syntax is allowed (the actual argument to print is an invocation of a generic function where the actual type argument is a Function type). Here's the report:

scratch.dart:1:26:
Error: Expected ')' before this.
main() => print(f<String Function(int)>(null));
                         ^^^^^^^^
Error: Compilation failed.

The problem also exists when invoked as dart2js --use-kernel ...

One known part of the problem is that isValidMethodTypeArguments in 'parser.dart' hasn't been updated to take the new style Function types into account, and in particular tryParseType expects only the syntax we had before those types were added. Other parts of the parser may also be unprepared for this kind of syntax once isValidMethodTypeArguments is updated such that an attempt will be made to parse a generic function invocation.

@eernstg eernstg added web-dart2js area-kernel type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Dec 7, 2017
@sigmundch
Copy link
Member

this seems to now be handled correctly by the CFE

@kmillikin kmillikin added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-kernel and removed legacy-area-front-end Legacy: Use area-dart-model instead. labels Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants