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.25k stars 1.58k forks source link

analyzer crash, blocking build #40075

Closed rakudrama closed 4 years ago

rakudrama commented 4 years ago

@stereotype441 I wonder if you could triage this to unblock the CL? The other try-bots pass, so I'm assuming this change is not causing any other problems.

https://dart-review.googlesource.com/c/sdk/+/131281 fails due to an analyzer crash

See stack trace at: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8891418424357593200/+/steps/check_dart_nnbd_sdk_for_static_errors/0/stdout

It is a bit hard to understand because the stack trace has been sorted.

stereotype441 commented 4 years ago

There's actually two stack traces in there (ugh). Untangling them yields (I think):

> #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
> #1      TypeSystem.promoteToNonNull (package:analyzer/src/generated/type_system.dart:3734:14)
> #2      PostfixExpressionResolver._resolveNullCheck (package:analyzer/src/dart/resolver/postfix_expression_resolver.dart:210:28)
> #3      PostfixExpressionResolver.resolve (package:analyzer/src/dart/resolver/postfix_expression_resolver.dart:49:7)
> #4      ResolverVisitor.visitPostfixExpression (package:analyzer/src/generated/resolver.dart:1517:32)
> #5      PostfixExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:8068:49)
> #6      ResolverVisitor.visitForStatementInScope (package:analyzer/src/generated/resolver.dart:1153:17)
> #7      ScopedVisitor.visitForStatement (package:analyzer/src/generated/resolver.dart:2498:7)
> #8      ForStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4665:49)
> #9      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7518:20)
> #10     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1085:17)
> #11     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1497:10)
> #12     UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3128:31)
> #13     ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:2196:13)
> #14     ScopedVisitor.visitStatementInScope (package:analyzer/src/generated/resolver.dart:2751:7)
> #15     ResolverVisitor.visitIfStatement (package:analyzer/src/generated/resolver.dart:1349:7)
> #16     IfStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:5629:49)
> #17     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7518:20)
> #18     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1085:17)
> #19     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1497:10)
> #20     UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3128:31)
> #21     ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:2196:13)
> #22     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1081:49)
> #23     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1040:13)
> #24     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1497:10)
> #25     UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3131:55)
> #26     ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:2207:13)
> #27     ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:667:13)
> #28     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1036:49)
> #29     FunctionExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4973:12)
> #30     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1497:10)
> #31     UnifyingAstVisitor.visitFunctionExpression (package:analyzer/dart/ast/visitor.dart:3263:57)
> #32     ScopedVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:2545:13)
> #33     ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:1254:13)
> #34     FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:4967:49)
> #35     FunctionDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4830:26)
> #36     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1497:10)
> #37     UnifyingAstVisitor.visitFunctionDeclaration (package:analyzer/dart/ast/visitor.dart:3256:59)
> #38     ScopedVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:2538:11)
> #39     ResolverVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:1226:11)
> #40     ScopedVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:2531:7)
> #41     ResolverVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:1208:13)
> #42     FunctionDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:4823:49)
> #43     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:752:23)
> #44     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2095:49)
> #45     LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:717:10)
> #46     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:155:7)
> #47     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
> #48     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:154:11)
> #49     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:123:14)
> #50     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:256:15)
> #51     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:122:43)
> #52     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1278:63)
> #53     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
> #54     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1254:20)
> #55     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:551:41)
> #56     AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:129:58)
> #57     AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:168:11)
> #58     AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:105:18)
> #59     Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:662:21)
> #60     Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:361:40)
> #61     _RootZone.runUnary (dart:async/zone.dart:1381:54)
> #62     _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
> #63     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
> #64     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
> #65     Future._addListener.<anonymous closure> (dart:async/future_impl.dart:391:9)
> #66     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
> #67     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
> #68     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
> #69     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)

and

> #0      AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1314:9)
> #1      PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
> #2      AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1254:20)
> #3      AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:551:41)
> #4      AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:129:58)
> #5      AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:168:11)
> #6      AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:105:18)
> #7      Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:662:21)
> #8      Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:361:40)
> #9      _RootZone.runUnary (dart:async/zone.dart:1381:54)
> #10     _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
> #11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
> #12     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
> #13     Future._addListener.<anonymous closure> (dart:async/future_impl.dart:391:9)
> #14     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
> #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
> #16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
> #17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)
stereotype441 commented 4 years ago

But I suspect this has been fixed. The latest bot results from that same CL don't show an analyzer stacktrace, instead they show:

Generating a patched sdk at /b/s/w/ir/tmp/t/check_sdk-HCNCOL/
Running dartanalyzer
1 analyzer errors.
Errors emitted to /b/s/w/ir/tmp/t/check_sdk-HCNCOL/errors.txt
Golden file does not match.
1c1
< 
---
> ERROR|STATIC_WARNING|ARGUMENT_TYPE_NOT_ASSIGNABLE|lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart|2632|59|16|The argument type 'Object?' can't be assigned to the parameter type 'Object'.

To update the golden file, run:
> <path-to-newly-built-dart-sdk>/bin/dart pkg/dev_compiler/tool/check_nnbd_sdk.dart --update-golden

(link)

rakudrama commented 4 years ago

It has been fixed. Thanks for digging into it.