Sdk: Analyzer crash when typing hexadecimal values

Created on 30 Jul 2017  路  4Comments  路  Source: dart-lang/sdk

The dart analyzer seems to crash when starting to type 0x for a hexadecimal expression.
Seen in VS Code and Webstorm - with Dart version 1.24.2.

Example code:

class Test {
  static const A = 0x0; // crashes
  static int B = 0x0; // crashes
  const int C = 0x0; // crashes
  int D = 0x0; // works fine

  test() {
    int a = 0x0; // works fine
  }
}

You need to type the 0x part manually to trigger the error. The example code itself works fine as it is when copy/pasting it. :)

P1 area-analyzer type-bug

All 4 comments

Possibly related to getSuggestions?

[10:49:05]: ==> {"id":"16","method":"analysis.updateContent","params":{"files":{"c:\\Users\\danny\\Desktop\\DartSample\\bin\\main.dart":{"type":"change","edits":[{"offset":33,"length":0,"replacement":"x","id":""}]}}}}
[10:49:05]: ==> {"id":"17","method":"completion.getSuggestions","params":{"file":"c:\\Users\\danny\\Desktop\\DartSample\\bin\\main.dart","offset":34}}
[10:49:05]: <== {"id":"16","result":{}}
[10:49:05]: <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
[10:49:05]: <== {"event":"server.error","params":{"isFatal":false,"message":"Captured exception","stackTrace":"NoSuchMethodError: The method '>=' was called on null.(snip)
NoSuchMethodError: The method '>=' was called on null.
Receiver: null
Tried calling: >=(4294967296)
#0      Driver._captureExceptions.<anonymous closure> (package:analysis_server/src/server/driver.dart:502)
#1      _CustomZone.handleUncaughtError (dart:async/zone.dart:981)
#2      _Future._propagateToListeners (dart:async/future_impl.dart:552)
#3      _Future._completeError (dart:async/future_impl.dart:486)
#4      _SyncCompleter._completeError (dart:async/future_impl.dart:55)
#5      _Completer.completeError (dart:async/future_impl.dart:27)
#6      AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:909)
#7      new Future.microtask.<anonymous closure> (dart:async/future.dart:184)
#8      _rootRun (dart:async/zone.dart:1116)
#9      _CustomZone.run (dart:async/zone.dart:1001)
#10     _CustomZone.runGuarded (dart:async/zone.dart:901)
#11     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:926)
#12     _rootRun (dart:async/zone.dart:1120)
#13     _CustomZone.run (dart:async/zone.dart:1001)
#14     _CustomZone.runGuarded (dart:async/zone.dart:901)
#15     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:926)
#16     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#17     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#18     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
#19     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)
<asynchronous suspension>
#20     AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:1481)
#21     new AnalysisServer (package:analysis_server/src/analysis_server.dart:458)
#22     SocketServer.createAnalysisServer (package:analysis_server/src/socket_server.dart:89)
#23     StdioAnalysisServer.serveStdio (package:analysis_server/src/server/stdio_server.dart:37)
#24     Driver.start.<anonymous closure> (package:analysis_server/src/server/driver.dart:474)
#25     _rootRun (dart:async/zone.dart:1120)
#26     _CustomZone.run (dart:async/zone.dart:1001)
#27     runZoned (dart:async/zone.dart:1467)
#28     Driver._captureExceptions (package:analysis_server/src/server/driver.dart:513)
#29     Driver.start (package:analysis_server/src/server/driver.dart:473)
#30     main (file:///E:/b/build/slave/dart-sdk-windows-stable/build/sdk/pkg/analysis_server/bin/server.dart:12)
#31     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
#32     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

I have not been able to reproduce either a crash or an exception when using the bleeding edge version of the analysis server. I entered the following by typing each character individually:

class Test {
  static const A = 0x
}

(the closing brace was inserted automatically). I'm not sure what else to try.

@bwilkerson My guess is that's fixed. I can repro on 1.24.2 on both Mac and PC by opening an empty folder with a single Dart file with the contents you pasted above and then just typing any single keystroke.

If I set dart.analyzerPath to my checked out SDK and reload, I am unable to repro. Removing the setting and reloading, I can repro again.

I'll close on the assumption that this is fixed. If anyone can show that it isn't, please let me know so I can re-open this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DartBot picture DartBot  路  3Comments

bergwerf picture bergwerf  路  3Comments

ranquild picture ranquild  路  3Comments

rinick picture rinick  路  3Comments

Hixie picture Hixie  路  3Comments