dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

Internal error: Exception while using a AvoidRedundantArgumentValues to visit... #56448

Open thermoworker opened 2 months ago

thermoworker commented 2 months ago

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 AvoidRedundantArgumentValues to visit a FunctionExpressionInvocationImpl in NamedExpressionImpl in ArgumentListImpl in InstanceCreationExpressionImpl in NamedExpressionImpl in ArgumentListImpl in InstanceCreationExpressionImpl in ReturnStatementImpl in BlockImpl in BlockFunctionBodyImpl in MethodDeclarationImpl in ClassDeclarationImpl in CompilationUnitImpl Bad state: [library: null][this: (DefaultParameterElementImpl) [TextTheme? textTheme]][enclosingElement: null][reference: null]

0 ConstVariableElement.computeConstantValue (package:analyzer/src/dart/element/element.dart:1292:9)

1 _Visitor.checkArgument (package:linter/src/rules/avoid_redundant_argument_values.dart:105:23)

2 _Visitor.check (package:linter/src/rules/avoid_redundant_argument_values.dart:88:7)

3 _Visitor.visitFunctionExpressionInvocation (package:linter/src/rules/avoid_redundant_argument_values.dart:126:5)

4 FunctionExpressionInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:8378:15)

5 LinterVisitor._runSubscriptions (package:analyzer/src/lint/linter_visitor.dart:1096:14)

6 LinterVisitor.visitFunctionExpressionInvocation (package:analyzer/src/lint/linter_visitor.dart:446:5)

7 FunctionExpressionInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:8378:15)

8 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:12183:17)

9 LinterVisitor.visitNamedExpression (package:analyzer/src/lint/linter_visitor.dart:663:10)

10 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:12173:50)

11 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12583:20)

12 ArgumentListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:498:16)

13 LinterVisitor.visitArgumentList (package:analyzer/src/lint/linter_visitor.dart:45:10)

14 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:494:50)

15 InstanceCreationExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10134:19)

16 LinterVisitor.visitInstanceCreationExpression (package:analyzer/src/lint/linter_visitor.dart:537:10)

17 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:10123:15)

18 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:12183:17)

19 LinterVisitor.visitNamedExpression (package:analyzer/src/lint/linter_visitor.dart:663:10)

20 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:12173:50)

21 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12583:20)

22 ArgumentListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:498:16)

23 LinterVisitor.visitArgumentList (package:analyzer/src/lint/linter_visitor.dart:45:10)

24 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:494:50)

25 InstanceCreationExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10134:19)

26 LinterVisitor.visitInstanceCreationExpression (package:analyzer/src/lint/linter_visitor.dart:537:10)

27 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:10123:15)

28 ReturnStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:15088:18)

29 LinterVisitor.visitReturnStatement (package:analyzer/src/lint/linter_visitor.dart:873:10)

30 ReturnStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:15084:50)

31 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12583:20)

32 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2091:17)

33 LinterVisitor.visitBlock (package:analyzer/src/lint/linter_visitor.dart:111:10)

34 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:2087:50)

35 BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2047:12)

36 LinterVisitor.visitBlockFunctionBody (package:analyzer/src/lint/linter_visitor.dart:117:10)

37 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:2039:50)

38 MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:11693:10)

39 LinterVisitor.visitMethodDeclaration (package:analyzer/src/lint/linter_visitor.dart:639:10)

40 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:11685:50)

41 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12583:20)

42 ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2954:13)

43 LinterVisitor.visitClassDeclaration (package:analyzer/src/lint/linter_visitor.dart:165:10)

44 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:2944:50)

45 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:12583:20)

46 CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3614:21)

47 LinterVisitor.visitCompilationUnit (package:analyzer/src/lint/linter_visitor.dart:189:10)

48 CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:3607:50)

49 LibraryAnalyzer._computeLints (package:analyzer/src/dart/analysis/library_analyzer.dart:398:12)

50 LibraryAnalyzer._computeDiagnostics (package:analyzer/src/dart/analysis/library_analyzer.dart:323:7)

51 LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:108:5)

52 AnalysisDriver._analyzeFileImpl. (package:analyzer/src/dart/analysis/driver.dart:1394:11)

#53 PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14) #54 AnalysisDriver._analyzeFile. (package:analyzer/src/dart/analysis/driver.dart:1308:9) #55 OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14) #56 AnalysisDriver._analyzeFile (package:analyzer/src/dart/analysis/driver.dart:1305:5) #57 AnalysisDriver._produceErrors (package:analyzer/src/dart/analysis/driver.dart:2020:5) #58 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1245:7) #59 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2449:7) null
dart-github-bot commented 2 months ago

Summary: The Analysis Server encountered an internal error while using the AvoidRedundantArgumentValues linter rule to analyze a complex expression involving nested function calls and object creation. The error occurred during the computation of a constant value, resulting in a Bad state exception.

FaFre commented 2 months ago

I saw the same error while investigating the issue why VSCode won't show any information lints anymore.

Dart SDK version: 3.5.0 (stable) (Tue Jul 30 02:17:59 2024 -0700) on "linux_x64"