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

assert/2 crashes but should be legal #9753

Closed
stevemessick opened this issue Apr 8, 2013 · 2 comments
Closed

assert/2 crashes but should be legal #9753

stevemessick opened this issue Apr 8, 2013 · 2 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@stevemessick
Copy link
Contributor

stevemessick commented Apr 8, 2013

[ed note: I think this message comes from the VM]

With just assert(false), it opens up the debugger.
With assert(false, "impossible") it dies with this internal error (at runtime).

This "syntax error" happens at runtime. It does not prevent the code from running. I'm guessing that "Internal error" means to report it?

Anyway, it would be nice if assert() allowed an optional second parameter String message, since otherwise it's going to mean falling back to good old assert(condition && "message") like in C/C++. One advantage of having the message as an actual parameter instead of using the && shim is to do something useful with it, like print it out (especially useful on the command line).

////////////////////////////////////////////////////////////////////////////////////
Editor: 0.4.4_r20810 (2013-04-03)
OS: Linux - amd64 (3.5.0-26-generic)
JVM: 1.7.0_15

projects: 5

open dart files: 2

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 889 / 463 / 218 MB
thread count: 33
analysis: 0 tasks, 29 libraries, 6 contexts
index: 85962 relationships and 0 attributes in 15459 elements in 147 resources stored in 2 MB on disk

SDK installed: true
Dartium installed: true
analysis engine: dartc


Attachment:
screenshot.png (116.36 KB)

@iposva-google
Copy link
Contributor

@stevemessick stevemessick added Type-Enhancement area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Apr 8, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed accepted labels Feb 29, 2016
@munificent
Copy link
Member

We are adding messages to assert(): #24213

@munificent munificent added the closed-duplicate Closed in favor of an existing report label Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants