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

[NNBD] Analyzer Crash #43213

Closed sgrekhov closed 4 years ago

sgrekhov commented 4 years ago

Analyzer Crashes on the following test


extension MySimpleExt on String {
  bool get test => false;
  int getANum() => 12345;
  void tryme() {}
}

main() {
  bool res1 = MySimpleExt("testme") == true; //# 01: compile-time error
  var  res2 = MySimpleExt("testme") == 14;   //# 02: compile-time error

  bool res3 = MySimpleExt("testme") != true; //# 03: compile-time error
  var  res4 = MySimpleExt("testme") != 128;  //# 04: compile-time error
}

Output is


/=========================================================================================================================================================\
| analyzer-asserts-strong-linux:co19/LanguageFeatures/Extension-methods/overriding_access_A03_t01/01 is new and failed (Crash, expected CompileTimeError) |
\=========================================================================================================================================================/

--- Command "dart2analyzer" (took 45ms):
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart-sdk/bin/dartanalyzer --enable-experiment=non-nullable --ignore-unrecognized-flags --packages=/b/s/w/ir/cache/builder/sdk/.packages --format=machine --no-hints /b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_tests/co19/LanguageFeatures/Extension-methods/overriding_access_A03_t01_01.dart

exit code:
253

stderr:
NoSuchMethodError: The getter 'nullabilitySuffix' was called on null.
Receiver: null
Tried calling: nullabilitySuffix
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      SubtypeHelper.isSubtypeOf (package:analyzer/src/dart/element/subtype.dart:51:29)
#2      TypeSystemImpl.isSubtypeOf2 (package:analyzer/src/dart/element/type_system.dart:1286:27)
#3      TypeSystemTypeOperations.isSubtypeOf (package:analyzer/src/dart/resolver/flow_analysis_visitor.dart:362:23)
#4      TypeSystemTypeOperations.classifyType (package:analyzer/src/dart/resolver/flow_analysis_visitor.dart:329:9)
#5      _FlowAnalysisImpl.equalityOp_end (package:_fe_analyzer_shared/src/flow_analysis/flow_analysis.dart:2469:24)
#6      BinaryExpressionResolver._resolveEqual (package:analyzer/src/dart/resolver/binary_expression_resolver.dart:145:11)
#7      BinaryExpressionResolver.resolve (package:analyzer/src/dart/resolver/binary_expression_resolver.dart:59:7)
#8      ResolverVisitor.visitBinaryExpression (package:analyzer/src/generated/resolver.dart:726:31)
#9      BinaryExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:962:49)
#10     VariableDeclarationResolver.resolve (package:analyzer/src/dart/resolver/variable_declaration_resolver.dart:57:17)
#11     ResolverVisitor.visitVariableDeclaration (package:analyzer/src/generated/resolver.dart:1743:34)
#12     VariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:10526:49)
#13     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7522:20)
#14     VariableDeclarationListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10632:16)
#15     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1487:10)
#16     UnifyingAstVisitor.visitVariableDeclarationList (package:analyzer/dart/ast/visitor.dart:3485:7)
#17     ResolverVisitor.visitVariableDeclarationList (package:analyzer/src/generated/resolver.dart:1757:11)
#18     VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10626:15)
#19     VariableDeclarationStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10680:20)
#20     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1487:10)
#21     UnifyingAstVisitor.visitVariableDeclarationStatement (package:analyzer/dart/ast/visitor.dart:3489:7)
#22     VariableDeclarationStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:10676:15)
#23     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7522:20)
#24     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1080:17)
#25     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1487:10)
#26     UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3143:31)
#27     ScopedVisitor.visitBlock.<anonymous closure> (package:analyzer/src/generated/resolver.dart:2178:13)
#28     ScopedVisitor._withDeclaredLocals (package:analyzer/src/generated/resolver.dart:2775:8)
#29     ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:2177:5)
#30     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1076:49)
#31     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1035:13)
#32     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1487:10)
#33     UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3146:55)
#34     ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:2187:13)
#35     ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:733:13)
#36     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1031:49)
#37     FunctionExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4955:12)
#38     FunctionExpressionResolver.resolve (package:analyzer/src/dart/resolver/function_expression_resolver.dart:66:10)
#39     ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:1211:35)
#40     FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:4949:49)
#41     FunctionDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4818:26)
#42     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1487:10)
#43     UnifyingAstVisitor.visitFunctionDeclaration (package:analyzer/dart/ast/visitor.dart:3271:59)
#44     ScopedVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:2493:11)
#45     ResolverVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:1201:11)
#46     ScopedVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:2486:7)
#47     ResolverVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:1170:11)
#48     FunctionDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:4811:49)
#49     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:865:23)
#50     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2119:49)
#51     LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:721:10)
#52     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:133:7)
#53     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#54     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:132:11)
#55     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:105:12)
#56     AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1286:63)
#57     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#58     AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1263:20)
#59     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1216:14)
#60     _rootRun (dart:async/zone.dart:1190:13)
#61     _CustomZone.run (dart:async/zone.dart:1093:19)
#62     _runZoned (dart:async/zone.dart:1630:10)
#63     runZoned (dart:async/zone.dart:1550:10)
#64     NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#65     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1215:40)
#66     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:552:41)
<asynchronous suspension>
#67     AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:121:47)
<asynchronous suspension>
#68     AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:157:11)
<asynchronous suspension>
#69     AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:99:18)
<asynchronous suspension>
#70     Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:622:21)
#71     Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:346:30)
<asynchronous suspension>
#72     Driver._analyzeAll (package:analyzer_cli/src/driver.dart:183:18)
<asynchronous suspension>
#73     Driver.start.<anonymous closure> (package:analyzer_cli/src/driver.dart:139:22)
<asynchronous suspension>
#74     Driver.start.<anonymous closure> (package:analyzer_cli/src/driver.dart)
#75     BatchRunner.runAsBatch.<anonymous closure> (package:analyzer_cli/src/batch_mode.dart:53:35)
<asynchronous suspension>
#76     BatchRunner.runAsBatch.<anonymous closure> (package:analyzer_cli/src/batch_mode.dart)
#77     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#78     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#79     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#80     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:69:11)
#81     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#82     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#83     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:155:13)
#84     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:130:5)
#85     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)
#86     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121:24)
#87     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#88     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#89     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#90     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:69:11)
#91     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#92     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#93     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7)
#94     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20)
#95     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)
#96     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#97     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121:24)
#98     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#99     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#100    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#101    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#102    _StreamController._add (dart:async/stream_controller.dart:682:7)
#103    _StreamController.add (dart:async/stream_controller.dart:624:5)
#104    _Socket._onData (dart:io-patch/socket_patch.dart:2044:41)
#105    _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#106    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#107    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#108    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#109    _StreamController._add (dart:async/stream_controller.dart:682:7)
#110    _StreamController.add (dart:async/stream_controller.dart:624:5)
#111    new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1580:33)
#112    _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1076:14)
#113    _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#114    _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#115    _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#116    _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

#0      AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1316:9)
#1      PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#2      AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1263:20)
#3      AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1216: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:1215:40)
#10     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:552:41)
<asynchronous suspension>
#11     AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:121:47)
<asynchronous suspension>
#12     AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:157:11)
<asynchronous suspension>
#13     AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:99:18)
<asynchronous suspension>
#14     Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:622:21)
#15     Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:346:30)
<asynchronous suspension>
#16     Driver._analyzeAll (package:analyzer_cli/src/driver.dart:183:18)
<asynchronous suspension>
#17     Driver.start.<anonymous closure> (package:analyzer_cli/src/driver.dart:139:22)
<asynchronous suspension>
#18     Driver.start.<anonymous closure> (package:analyzer_cli/src/driver.dart)
#19     BatchRunner.runAsBatch.<anonymous closure> (package:analyzer_cli/src/batch_mode.dart:53:35)
<asynchronous suspension>
#20     BatchRunner.runAsBatch.<anonymous closure> (package:analyzer_cli/src/batch_mode.dart)
#21     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#22     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#23     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#24     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:69:11)
#25     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#26     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#27     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:155:13)
#28     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:130:5)
#29     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)
#30     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121:24)
#31     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#32     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#33     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#34     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:69:11)
#35     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#36     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#37     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7)
#38     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20)
#39     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)
#40     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#41     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121:24)
#42     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#43     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#44     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#45     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#46     _StreamController._add (dart:async/stream_controller.dart:682:7)
#47     _StreamController.add (dart:async/stream_controller.dart:624:5)
#48     _Socket._onData (dart:io-patch/socket_patch.dart:2044:41)
#49     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#50     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#51     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#52     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#53     _StreamController._add (dart:async/stream_controller.dart:682:7)
#54     _StreamController.add (dart:async/stream_controller.dart:624:5)
#55     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1580:33)
#56     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1076:14)
#57     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#58     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#59     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#60     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

--- Re-run this test:
python tools/test.py -n analyzer-asserts-strong-linux co19/LanguageFeatures/Extension-methods/overriding_access_A03_t01/01
leafpetersen commented 4 years ago

@scheglov looks like maybe this is fixed now?

scheglov commented 4 years ago

Yes, fixed as https://github.com/dart-lang/sdk/issues/43269 in 213bffcde28c7d83c37c7abeddc1a39186013686.