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

FunctionTypedFormalParameterImpl.endToken does not take "?" into account #38990

Closed
munificent opened this issue Oct 18, 2019 · 1 comment
Closed
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release

Comments

@munificent
Copy link
Member

dartfmt has an issue (dart-lang/dart_style#862) where a comma after a nullable function-typed formal parameter gets discarded. To find the comma after each parameter, it uses param.endToken.next on each parameter. It looks like that wasn't updated when the optional trailing ? was added to the AST:

  @override
  Token get endToken => _parameters.endToken;

That should probably be:

  @override
  Token get endToken => question ?? _parameters.endToken;

I should be able to put a little hack into dartfmt to work around this until it's fixed.

@munificent munificent added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Oct 18, 2019
munificent added a commit to dart-lang/dart_style that referenced this issue Oct 18, 2019
@srawlins srawlins added the NNBD Issues related to NNBD Release label Dec 29, 2019
@scheglov scheglov self-assigned this Feb 28, 2020
@scheglov
Copy link
Contributor

dart-bot pushed a commit that referenced this issue Feb 28, 2020
…ion, endToken.

R=brianwilkerson@google.com, paulberry@google.com

Bug: #38990
Change-Id: Iaf58a6588f5098168f59edba1c82397dcf7077ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137736
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

3 participants