Skip to content

Server error: "Missing implementation of visitFunctionExpression" #53075

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
DanTup opened this issue Jul 31, 2023 · 6 comments
Closed

Server error: "Missing implementation of visitFunctionExpression" #53075

DanTup opened this issue Jul 31, 2023 · 6 comments
Assignees
Labels
analyzer-crash-report Issues which have been reported due to an analysis server crash legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DanTup
Copy link
Collaborator

DanTup commented Jul 31, 2023

Raised at Dart-Code/Dart-Code#4666, I was able to reduce it to this (it seems to require const on the constructor and the function call in the assert):

class StylishBottomBar  {
  const StylishBottomBar({
    List<String?> items,
  }) : assert(items.every((String? item) => item != null));
}

It causes the server to terminate with the following in the log:

[12:12:14 PM] [Analyzer] [Error] Unhandled exception:
Exception: Missing implementation of visitFunctionExpression
#0      ThrowingAstVisitor._throw (package:analyzer/dart/ast/visitor.dart:2842:5)
#1      ThrowingAstVisitor.visitFunctionExpression (package:analyzer/dart/ast/visitor.dart:2514:58)
#2      FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6124:50)
#3      AstBinaryWriter._writeNodeList (package:analyzer/src/summary2/ast_binary_writer.dart:939:19)
#4      AstBinaryWriter.visitArgumentList …

I'm not sure why the calls tack is truncated, but below is a screenshot of it in the debugger (I couldn't dump it as text, sorry).

Screenshot 2023-07-31 122607

(@scheglov FYI)

@srawlins
Copy link
Member

CC @kallentu , looks like a bug specific to const constructor asserts; you probably have the freshest notion of this code :)

@srawlins srawlins added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) analyzer-crash-report Issues which have been reported due to an analysis server crash labels Jul 31, 2023
@kallentu
Copy link
Member

I looked into what makes the difference between const and non-consting that constructor and it's the call of this line:

_resolutionSink._writeNodeList(element.constantInitializers);

And all this happens without ever entering the constant evaluator, so I suspect @scheglov might have more context on this?

The _constantInitializers do have a FunctionExpression in there ((String? item) => item != null) and the AstBinaryWriter doesn't implement it, but I'm not sure if it's as straight forward as making a visitFunctionExpression or if something else is wrong up the pipeline.

@shashkiranr
Copy link

Hi,

Any Workaround for this issue? The dart analyser keeps failing and the auto complete feature in Android Studio for Flutter seems to fail with it in classes where const constructor and assert are used and referenced

@srawlins
Copy link
Member

@scheglov can you look at this?

@kallentu
Copy link
Member

@srawlins I can take a go at fixing this. I was taking a look at it yesterday.

@kallentu kallentu self-assigned this Sep 28, 2023
@scheglov
Copy link
Contributor

We might need to use replaceNotSerializableNode in one more place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-crash-report Issues which have been reported due to an analysis server crash legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants