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

Crash analyzing NNBD library that re-exports core #41380

Closed munificent closed 4 years ago

munificent commented 4 years ago

On bleeding edge at commit c853f70feadee8707475d78b14ed9cc89ebf71dd. If I have:

test.dart:

import 'reexport_core.dart' as core;

reexport_core.dart:

export 'dart:core';

And then run:

$ ./xcodebuild/ReleaseX64NNBD/dart-sdk/bin/dartanalyzer --enable-experiment=non-nullable test.dart

I get:

Unhandled exception:
NoSuchMethodError: The getter 'isNonNullableByDefault' was called on null.
Receiver: null
Tried calling: isNonNullableByDefault
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      ErrorVerifier._checkForExportLegacySymbol (package:analyzer/src/generated/error_verifier.dart:2515:28)
#2      ErrorVerifier.visitExportDirective (package:analyzer/src/generated/error_verifier.dart:595:7)
#3      ExportDirectiveImpl.accept (package:analyzer/src/dart/ast/ast.dart:3464:49)
#4      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7584:20)
#5      CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2133:19)
#6      RecursiveAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:725:10)
#7      ErrorVerifier.visitCompilationUnit (package:analyzer/src/generated/error_verifier.dart:506:11)
#8      CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2127:49)
#9      LibraryAnalyzer._computeVerifyErrors (package:analyzer/src/dart/analysis/library_analyzer.dart:381:10)
#10     LibraryAnalyzer.analyzeSync.<anonymous closure>.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:160:9)
#11     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#12     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:159:13)
#13     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:256:15)
#14     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:158:34)
#15     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:116:14)
#16     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:256:15)
#17     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:115:43)
#18     AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1313:63)
#19     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#20     AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1289:20)
#21     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1240:14)
#22     _rootRun (dart:async/zone.dart:1190:13)
#23     _CustomZone.run (dart:async/zone.dart:1093:19)
#24     _runZoned (dart:async/zone.dart:1630:10)
#25     runZoned (dart:async/zone.dart:1550:10)
#26     NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#27     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1239:40)
#28     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:565:41)
#29     AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:129:49)
<asynchronous suspension>
#30     AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:168:11)
<asynchronous suspension>
#31     AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:105:18)
<asynchronous suspension>
#32     Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:636:21)
#33     Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:353:30)
#34     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#35     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#36     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:686:45)
#37     Future._propagateToListeners (dart:async/future_impl.dart:715:32)
#38     Future._addListener.<anonymous closure> (dart:async/future_impl.dart:393:9)
#39     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#40     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#41     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:117:13)
#42     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:5)

#0      AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1349:9)
#1      PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#2      AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1289:20)
#3      AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1240:14)
#4      _rootRun (dart:async/zone.dart:1190:13)
#5      _CustomZone.run (dart:async/zone.dart:1093:19)
#6      _runZoned (dart:async/zone.dart:1630:10)
#7      runZoned (dart:async/zone.dart:1550:10)
#8      NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#9      AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1239:40)
#10     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:565:41)
#11     AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:129:49)
<asynchronous suspension>
#12     AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:168:11)
<asynchronous suspension>
#13     AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:105:18)
<asynchronous suspension>
#14     Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:636:21)
#15     Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:353:30)
#16     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#17     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#18     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:686:45)
#19     Future._propagateToListeners (dart:async/future_impl.dart:715:32)
#20     Future._addListener.<anonymous closure> (dart:async/future_impl.dart:393:9)
#21     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#22     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#23     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:117:13)
#24     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:5)

(The irony of the crash being a null reference error is not lost on me.)

scheglov commented 4 years ago

https://dart-review.googlesource.com/c/sdk/+/142900