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 analyze error with latest Flutter SDK #57022

Closed
kenzieschmoll opened this issue Nov 4, 2024 · 2 comments
Closed

dart analyze error with latest Flutter SDK #57022

kenzieschmoll opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures 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)

Comments

@kenzieschmoll
Copy link
Contributor

/home/runner/work/devtools/devtools/packages/devtools_app > /home/runner/work/devtools/devtools/tool/flutter-sdk/bin/dart analyze --fatal-infos
Analyzing devtools_app...
An unexpected error was encountered by the Analysis Server.
Please file an issue at https://github.com/dart-lang/sdk/issues/new/choose with the following details:

Internal error: Exception while using a AvoidClassesWithOnlyStaticMembers to visit a ClassDeclarationImpl in CompilationUnitImpl
type 'MethodMember' is not a subtype of type 'ExecutableFragment' in type cast
#0      Interface.map2.<anonymous closure> (package:analyzer/src/dart/element/inheritance_manager3.dart:1265:33)
#1      MapBase.map (dart:collection/maps.dart:82:28)
#2      Interface.map2 (package:analyzer/src/dart/element/inheritance_manager3.dart:1264:16)
#3      _Visitor.visitClassDeclaration (package:linter/src/rules/avoid_classes_with_only_static_members.dart:46:25)
#4      ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:2882:50)
#5      LinterVisitor._runSubscriptions (package:analyzer/src/lint/linter_visitor.dart:1083:14)
#6      LinterVisitor.visitClassDeclaration (package:analyzer/src/lint/linter_visitor.dart:158:5)
#7      ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:2882:50)
#8      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12939:20)
#9      CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3553:21)
#10     LinterVisitor.visitCompilationUnit (package:analyzer/src/lint/linter_visitor.dart:183:10)
#11     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:3546:50)
#12     LibraryAnalyzer._computeLints (package:analyzer/src/dart/analysis/library_analyzer.dart:410:12)
#13     LibraryAnalyzer._computeDiagnostics (package:analyzer/src/dart/analysis/library_analyzer.dart:334:7)
#14     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:109:5)
#15     AnalysisDriver._analyzeFileImpl.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1397:11)
<asynchronous suspension>
#16     PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14)
<asynchronous suspension>
#17     AnalysisDriver._analyzeFile.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1311:9)
<asynchronous suspension>
#18     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#19     AnalysisDriver._analyzeFile (package:analyzer/src/dart/analysis/driver.dart:1308:5)
<asynchronous suspension>
#20     AnalysisDriver._produceErrors (package:analyzer/src/dart/analysis/driver.dart:2013:5)
<asynchronous suspension>
#21     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1248:7)
<asynchronous suspension>
#22     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2442:7)
<asynchronous suspension>

First noticed on this PR flutter/devtools#8504, which upgrades the version of Flutter that DevTools is built with to 55c026a2304d9e0d8acc9f3843ee5900fabf96b4.

Repro steps:

  1. Checkout Flutter @ 55c026a2304d9e0d8acc9f3843ee5900fabf96b4
  2. From the devtools/packages/devtools_app directory, run dart analyze . (provided that which dart points to the Dart from the Flutter SDK you just checked out flutter/bin/dart).

This may reproduce on other Dart or Flutter projects, but the DevTools repo has a consistent repro.

@dart-github-bot
Copy link
Collaborator

Summary: The dart analyze command fails with an internal error in the Analysis Server when using the latest Flutter SDK. The error occurs during the analysis of a project, specifically when the AvoidClassesWithOnlyStaticMembers linter rule is applied.

@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 4, 2024
@pq pq added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Nov 4, 2024
@pq pq self-assigned this Nov 4, 2024
@pq
Copy link
Member

pq commented Nov 4, 2024

Thanks for reporting this @kenzieschmoll!

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. P1 A high priority bug; for example, a single project is unusable or has many test failures 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)
Projects
None yet
Development

No branches or pull requests

3 participants