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

dart2js crash on List<void foo()> l; #25890

Closed
pemdas opened this issue Mar 1, 2016 · 4 comments
Closed

dart2js crash on List<void foo()> l; #25890

pemdas opened this issue Mar 1, 2016 · 4 comments
Labels
closed-obsolete Closed as the reported issue is no longer relevant type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@pemdas
Copy link

pemdas commented Mar 1, 2016

Versions involved:

Justins-MBP:~ justin$ dart2js --version
Dart-to-JavaScript compiler (dart2js) version: 1.13.2

Justins-MBP:~ justin$ uname -a
Darwin Justins-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

This code compiles:

typedef void foo();
List<foo> l;

This code has a rather different result:

List<void foo()> l;
Justins-MBP:~ justin$ dart2js foo.dart
foo.dart:1:5:
Error: Can't find '>' to match '<'.
List<void foo()> l;
    ^
foo.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 (1.13.2), 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 'next'.

NoSuchMethodError: method not found: 'next'
Receiver: null
Arguments: []
#0 Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2 Parser.findMemberName (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/parser.dart:1054)
#3 Parser.parseTopLevelMember (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/parser.dart:740)
#4 Parser.parseTopLevelDeclaration (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/parser.dart:138)
#5 Parser.parseUnit (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/parser.dart:111)
#6 DietParserTask.dietParse. (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/diet_parser_task.dart:35)
#7 CompilerTask.measure (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/common/tasks.dart:55)
#8 DietParserTask.dietParse (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/parser/diet_parser_task.dart:29)
#9 ScannerTask.scanElements (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/scanner/scanner_task.dart:53)
#10 ScannerTask.scan. (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/scanner/scanner_task.dart:42)
#11 CompilerTask.measure (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/common/tasks.dart:55)
#12 ScannerTask.scan (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/scanner/scanner_task.dart:41)
#13 ScannerTask.scanLibrary (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/scanner/scanner_task.dart:37)
#14 _LibraryLoaderTask.createLibrarySync. (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/library_loader.dart:635)
#15 _CompilerDiagnosticReporter.withCurrentElement (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/compiler.dart:1691)
#16 _LibraryLoaderTask.createLibrarySync (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/library_loader.dart:629)
#17 _LibraryLoaderTask.createLibrary.. (file:///b/build/slave/dart-sdk-mac-stable/build/sdk/pkg/compiler/lib/src/library_loader.dart:613)
#18 _RootZone.runUnary (dart:async/zone.dart:1149)
#19 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
#20 _Future._propagateToListeners (dart:async/future_impl.dart:585)
#21 _Future._completeWithValue (dart:async/future_impl.dart:376)
#22 _Future._asyncComplete. (dart:async/future_impl.dart:430)
#23 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#24 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#25 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

I haven't been able to find a reference that tells me definitively whether the non-typedef'd version should compile (seems like it should?), but even if this is a syntax error, it shouldn't crash the compiler.

@pemdas
Copy link
Author

pemdas commented Mar 1, 2016

Ugh, angle brackets got eaten by some html sanitizer, apparently. Let me try again with manual escaping:

The broken code snippet is

List<void foo()> l;

@lrhn lrhn added web-dart2js type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Mar 2, 2016
@lrhn
Copy link
Member

lrhn commented Mar 2, 2016

The code is invalid, but it shouldn't cause the compiler to crash.

@zoechi
Copy link
Contributor

zoechi commented Mar 2, 2016

@pemdas wrap code blocks in triple ` (backtick)

@sigmundch sigmundch added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 26, 2018
@sigmundch
Copy link
Member

(this is now handled by the CFE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants