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

Dart Analysis Server server crashed on generics refactor #57058

Open
Solido opened this issue Nov 8, 2024 · 3 comments
Open

Dart Analysis Server server crashed on generics refactor #57058

Solido opened this issue Nov 8, 2024 · 3 comments
Labels
analyzer-crash-report Issues which have been reported due to an analysis server crash area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Solido
Copy link

Solido commented Nov 8, 2024

  • Dart analyzer and linter

Flutter master.

I’m working on a project that structure around a core class:

sealed class Operation<T, C, R>
Everything was working well but I found a solution to simplify to <T, R>

The moment I started the refactor I got this log analyze crashed living
whole source no more traversable.

Restarting the server crash it after 5 tentatives.
[19:45:28] [Analyzer] [Error] [Bad state: Empty path: []
#0      InterfaceLeastUpperBoundHelper._computeTypeAtMaxUniqueDepth (package:analyzer/src/dart/element/least_upper_bound.dart:314:5)
#1      InterfaceLeastUpperBoundHelper._computeLeastUpperBound (package:analyzer/src/dart/element/least_upper_bound.dart:176:12)
#2      InterfaceLeastUpperBoundHelper.compute (package:analyzer/src/dart/element/least_upper_bound.dart:103:18)
#3      LeastUpperBoundHelper.getLeastUpperBound (package:analyzer/src/dart/element/least_upper_bo…

Current status is I've been able to complete the refactor by hand, grep and memory
so I'm not sure what was triggering this crash as the code base is as deep as wide.

The main culprit seems around a Mixin without generics (dynamic) on Operation<T, C, R>
A warning was thrown before crash that sub classes cannot implement both the typed and generic methods.

I'm sorry I can not pinpoint more precisely the root cause to reproduce it.

Some more not much actionnables hints but maybe helpful:

I was able to start the conversion starting by the leaf-classes and then trying to go up
in the hierarchy. Changing the root class generic, removing C, was my last operation to have it
work.

Starting the refactor by the root class nearly instantly kill the analyzer.

Dear analyzer team, you have all my gratitude for this tool.
I've never felt so alone with my own code than when it is not active anymore... ;)

@dart-github-bot
Copy link
Collaborator

Summary: The Dart analysis server crashes when refactoring a sealed class with generics, specifically when removing a generic type parameter. The crash occurs after the user attempts to refactor a mixin without generics that extends the generic class.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Nov 8, 2024
@bwilkerson
Copy link
Member

@scheglov

@devoncarew devoncarew removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Nov 8, 2024
@scheglov
Copy link
Contributor

scheglov commented Nov 8, 2024

Noted, but I was not able to reproduce it.

@scheglov scheglov added P3 A lower priority bug or feature request analyzer-crash-report Issues which have been reported due to an analysis server crash labels Nov 8, 2024
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 area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants