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.24k stars 1.57k forks source link

dart2js explodes with "No error location for error" during an argument number mismatch #7003

Closed efortuna closed 9 years ago

efortuna commented 11 years ago

The code causing the problem was this line:

    JS('void', '#(#, #, #, #, #, #, #, #, #, #, #)', this, function, type,         canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey,         altKey, shiftKey, metaKey, altGraphKey);

This issue is this is one additional argument passed to the JS function than there are # slots (the "this" should be removed). OS: Mac OSX Mountain Lion Revision number: 15458

I was working on html libs, and wrote a new test (along with new functionality) where this showed up. I've attached the test file and the compiled js output just for info.

Here's the full output: FAILED: dart2js-chrome release_ia32 html/keyboard_event_test Expected: pass Actual: crash Unexpected compile-time error.

stdout: sdk/lib/html/dart2js/html_dart2js.dart:11368:8: Error: The compiler crashed when compiling this element.   void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable,        ^^^^^^^^^^^^^^^^^^^^^^ 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.

Internal error: No error location for error: Internal error: Wrong number of arguments for JS: #(#, #, #, #, #, #, #, #, #, #, #)

­0 Compiler.cancel (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:310:7)

­1 Compiler.internalError (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:278:11)

­2 Printer.visitLiteralExpression (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:803:29)

­3 LiteralExpression.accept (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/nodes.dart:441:64)

­4 Printer.visit (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:94:16)

­5 Printer.visitNestedExpression (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:435:12)

­6 Printer.visitExpressionStatement (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:166:26)

­7 ExpressionStatement.accept (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/nodes.dart:182:66)

­8 Printer.visit (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:94:16)

­9 Printer.blockOutWithoutBraces.blockOutWithoutBraces (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:144:12)

­10 List.forEach (dart:core-patch:860:8)

­11 Printer.blockOut (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:153:28)

­12 Printer.blockBody (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:124:15)

­13 Printer.functionOut (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:401:14)

­14 Printer.visitFun (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:710:16)

­15 Fun.accept (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/nodes.dart:699:50)

­16 Printer.visit (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:94:16)

­17 prettyPrint (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js/printer.dart:942:16)

­18 SsaCodeGeneratorTask.prettyPrint (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart:41:30)

­19 SsaCodeGeneratorTask.generateMethod.<anonymous closure> (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart:99:25)

­20 CompilerTask.measure (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:871:24)

­21 SsaCodeGeneratorTask.generateMethod (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart:67:19)

­22 SsaCodeGeneratorTask.generateCode (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart:50:28)

­23 JavaScriptBackend.codegen (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart:893:51)

­24 Compiler.codegen (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:686:20)

­25 WorkItem.run (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:57:21)

­26 Compiler.processQueue.<anonymous closure>.<anonymous closure> (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:578:54)

­27 Compiler.withCurrentElement (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:153:15)

­28 Compiler.withCurrentElement (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:173:7)

­29 Compiler.processQueue.<anonymous closure> (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:578:25)

­30 Enqueuer.forEach (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/enqueue.dart:397:8)

­31 Compiler.processQueue (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:577:18)

­32 Compiler.runCompiler (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:547:17)

­33 Compiler.run (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:344:18)

­34 Compiler.run (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/compiler.dart:345:7)

­35 Compiler.run (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart:158:29)

­36 compile (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/compiler.dart:55:15)

­37 compile (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart:289:28)

­38 compilerMain (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart:342:10)

­39 main (file:///Users/efortuna/git-dart/dart/sdk/lib/_internal/compiler/implementation/dart2js.dart:460:17)


Attachments: html_dart2js.dart (821.03 KB) keyboard_event_test.dart (707 Bytes)

kasperl commented 11 years ago

Added this to the Later milestone.

kasperl commented 11 years ago

Added TriageForM5 label.

kasperl commented 11 years ago

Removed this from the Later milestone. Added this to the M5 milestone. Removed TriageForM5 label.

kasperl commented 11 years ago

Removed this from the M5 milestone. Added this to the Later milestone.

kasperl commented 10 years ago

Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

kasperl commented 10 years ago

Removed Oldschool-Milestone-Later label.

sigmundch commented 9 years ago

given that JS() is used only by the dart: libraries, I'm inclined to not spend much effort on this at this time.

@rakudrama - do you agree or do you think we should make the compiler more resilient to these kind of mismatches?

rakudrama commented 9 years ago

Trivial to fix this: https://chromiumcodereview.appspot.com/1353243002/