Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misleading error when library-root is wrong #23599

Open
sigmundch opened this issue Jun 5, 2015 · 1 comment
Open

misleading error when library-root is wrong #23599

sigmundch opened this issue Jun 5, 2015 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. dart2js-crash P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@sigmundch
Copy link
Member

When using an incorrect library-root:

./sdk/bin/dart2js --library-root=/tmp/ foo.dart 

We get an error message indicating that core.dart is not found, but the exception shown afterwards is very noisy and misleading:

/tmp/lib/core/core.dart:
Error: Error reading '/tmp/lib/core/core.dart' (No such file or directory)
simple.dart:
Internal Error: The compiler crashed when compiling this element.

The compiler is broken.

When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.

The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.

Please include the following information:

* the name and version of your operating system,

* the Dart SDK build number (build number could not be determined), and

* the entire message you see here (including the full stack trace
  below as well as the source location above).

The compiler crashed: The null object does not have a getter 'sourcePosition'.

NoSuchMethodError: method not found: 'sourcePosition'
Receiver: null
Arguments: []
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      Compiler.spanFromElement (file:///path-to-dart2js/src/compiler.dart:1959:17)
#3      Compiler.spanFromSpannable (file:///path-to-dart2js/src/compiler.dart:1187:14)
#4      Compiler.reportDiagnostic (file:///path-to-dart2js/src/apiimpl.dart:359:27)
#5      Compiler.reportDiagnosticInternal (file:///path-to-dart2js/src/compiler.dart:1904:5)
#6      Compiler.internalError (file:///path-to-dart2js/src/compiler.dart:1149:5)
#7      Compiler.initializeCoreClasses (file:///path-to-dart2js/src/compiler.dart:1456:7)
#8      Compiler.onLibraryScanned (file:///path-to-dart2js/src/compiler.dart:1282:7)
#9      _LibraryLoaderTask.processLibraryTags.<anonymous closure> (file:///path-to-dart2js/src/library_loader.dart:411:23)
#10     _RootZone.runUnary (dart:async/zone.dart:1166)
#11     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#12     _Future._propagateToListeners (dart:async/future_impl.dart:577)
#13     _Future._complete (dart:async/future_impl.dart:358)
#14     Future.doWhile.<anonymous closure> (dart:async/future.dart:364)
#15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1104)
#16     _RootZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1133)
#17     _RootZone.runUnary (dart:async/zone.dart:1166)
#18     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#19     _Future._propagateToListeners (dart:async/future_impl.dart:577)
#20     _Future._completeWithValue (dart:async/future_impl.dart:368)
#21     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:422)
#22     _microtaskLoop (dart:async/schedule_microtask.dart:43)
#23     _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#24     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#25     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
@sigmundch
Copy link
Member Author

I've created https://codereview.chromium.org/1157433014/ to avoid a crash in the compiler. The output after that change is not perfect though, I'd rather have an error that just says to verify that the sdk libraries are in the right place.

The new error looks like:

/tmp/lib/core/core.dart:
Error: Error reading '/tmp/lib/core/core.dart' (No such file or directory)
Internal Error: dart:core library does not contain required classes: [Object, bool, num, int, double, String, Function, List, Type, Map, Null, StackTrace, Iterable, Symbol]
The compiler is broken.

When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.

The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.

Please include the following information:

* the name and version of your operating system,

* the Dart SDK build number (build number could not be determined), and

* the entire message you see here (including the full stack trace
  below as well as the source location above).

The compiler crashed: Internal Error: dart:core library does not contain required classes: [Object, bool, num, int, double, String, Function, List, Type, Map, Null, StackTrace, Iterable, Symbol]
#0      Compiler.internalError (file:///path-to-dart2js/src/compiler.dart:1151:5)
#1      Compiler.initializeCoreClasses (file:///path-to-dart2js/src/compiler.dart:1456:7)
#2      Compiler.onLibraryScanned (file:///path-to-dart2js/src/compiler.dart:1282:7)
#3      _LibraryLoaderTask.processLibraryTags.<anonymous closure> (file:///path-to-dart2js/src/library_loader.dart:411:23)
#4      _RootZone.runUnary (dart:async/zone.dart:1166)
#5      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#6      _Future._propagateToListeners (dart:async/future_impl.dart:577)
#7      _Future._complete (dart:async/future_impl.dart:358)
#8      Future.doWhile.<anonymous closure> (dart:async/future.dart:364)
#9      _RootZone.runUnaryGuarded (dart:async/zone.dart:1104)
#10     _RootZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1133)
#11     _RootZone.runUnary (dart:async/zone.dart:1166)
#12     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#13     _Future._propagateToListeners (dart:async/future_impl.dart:577)
#14     _Future._completeWithValue (dart:async/future_impl.dart:368)
#15     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:422)
#16     _microtaskLoop (dart:async/schedule_microtask.dart:43)
#17     _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#18     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#19     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

@sigmundch sigmundch added the P3 A lower priority bug or feature request label Sep 18, 2015
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. dart2js-crash P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants