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.09k stars 1.56k forks source link

try.dartlang.org saying Compilation failed for simple class #17725

Closed sethladd closed 9 years ago

sethladd commented 10 years ago

Consider this code:

class Hero {}

try.dartlang.org on Mar 23rd reports "Compilation failed"

Please see screenshot.

I also added a screenshot of my console.

(Related, would be cool to see the errors reports when compilation fails)


Attachments: [Screen Shot 2014-03-23 at 4.31.52 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-17725/comment-0/Screen Shot 2014-03-23 at 4.31.52 PM.png) (36.01 KB) [Screen Shot 2014-03-23 at 4.33.30 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-17725/comment-0/Screen Shot 2014-03-23 at 4.33.30 PM.png) (32.63 KB)

sethladd commented 10 years ago

Oh, I see that if I hover over the red underline, I see what the Error is. In this case, it's "Could not find main"

Surprised that main is required. My use case is to use try.dartlang.org as a syntax checker.

peter-ahe-google commented 10 years ago

Good point. We should do something about this.

peter-ahe-google commented 10 years ago

Issue #19595 has been merged into this issue.

peter-ahe-google commented 10 years ago

From Issue #19595:

An error is reported in recent development versions, for example, the version live at http://incr.try-dart-lang.appspot.com/ displays an error.

Once https://codereview.chromium.org/285903006/ lands, you'll get a better error message (compilation won't fail and it will be a runtime error). This CL should also enable the warning on Future.

Regardless, I'll keep this bug open to ensure that it is always clear why compilation failed. I'm not sure that a red line is enough.


Set owner to @peter-ahe-google. Removed Type-Defect label. Added Type-Enhancement, Accepted labels.

peter-ahe-google commented 10 years ago

Luke, perhaps this would be of interest to you. I think it would make sense to collect all (or some) "fatal" errors from the compiler and print them in the console. So for example, without CL 285903006 this would have produced:

Compilation failed due to the following error: Could not find 'main'.


cc @lukechurch.

peter-ahe-google commented 10 years ago

Issue #19595 has been merged into this issue.

peter-ahe-google commented 10 years ago

See also issue #19543 (lights/train diagram).

peter-ahe-google commented 10 years ago

Issue #19595 has been merged into this issue.

peter-ahe-google commented 10 years ago

The particular problem with "main" has been fixed in dart2js, and I've uploaded a new version of Try Dart!

We're still keeping this open to address the general issue of errors not being obvious.

peter-ahe-google commented 10 years ago

https://codereview.chromium.org/388223002


Added Started label.

peter-ahe-google commented 10 years ago

Fixed in r38191.


Added Fixed label.