Why don't my asserts work?

51 views
Skip to first unread message

Danny Tuppeny

unread,
Feb 17, 2017, 5:27:45 AM2/17/17
to Dart Misc
I have this code:

main() {
 
assert(1 == 0);
 
assert(1 == 1);
 
print("test");
}

I'm running with --checked, yet it doesn't crash it just outputs "test". It seems broken to me, but it seems like the sort of thing somebody would've noticed before (I can't find anything in the issue tracker).

It's Windows, SDK 1.22.0. Am I doing something silly, or should I raise a bug?
asserts.png

Vyacheslav Egorov

unread,
Feb 17, 2017, 5:36:48 AM2/17/17
to Dart Misc
VM options should go before the dart file name otherwise they become program options passed.

Try 

dart --checked bin/main.dart

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
--
// Vyacheslav Egorov

Danny Tuppeny

unread,
Feb 17, 2017, 5:39:48 AM2/17/17
to Dart Misc
Doh! I knew it'd be something silly. Thanks!

Bob Nystrom

unread,
Feb 17, 2017, 1:02:51 PM2/17/17
to General Dart Discussion

On Fri, Feb 17, 2017 at 2:39 AM, Danny Tuppeny <da...@tuppeny.com> wrote:
Doh! I knew it'd be something silly. Thanks!

If it makes you feel better, I make this mistake at least once every couple of months.

– bob

Jan Mostert

unread,
Feb 17, 2017, 1:40:25 PM2/17/17
to General Dart Discussion
I've done it as well, haha
Maybe a warning saying your input params are out of place would nudge the user in the right direction


Günter Zöchbauer

unread,
Feb 18, 2017, 7:49:03 AM2/18/17
to Dart Misc


On Friday, February 17, 2017 at 7:40:25 PM UTC+1, Jan Vladimir Mostert wrote:
I've done it as well, haha
Maybe a warning saying your input params are out of place would nudge the user in the right direction


That would make it invalid to use parameters like --checked (and all others `dart` supports) for you Dart application

Danny Tuppeny

unread,
Feb 18, 2017, 2:59:31 PM2/18/17
to mi...@dartlang.org
On Sat, 18 Feb 2017 at 12:49 Günter Zöchbauer <gzo...@gmail.com> wrote:
Maybe a warning saying your input params are out of place would nudge the user in the right direction

That would make it invalid to use parameters like --checked (and all others `dart` supports) for you Dart application

I was gonna reply with the same, though he did say warn, so possibly you could get away with it. Though I agree it's not a good idea - especially if you might add new switches and start writing new output to stdout/stderr when things consuming them might not expect it (Dart already does this when you run Observatory to pass the port back; it's a bit weird IMO!).

Stephen Adams

unread,
Feb 18, 2017, 3:28:10 PM2/18/17
to General Dart Discussion
​dart2js is a Dart application that needs to allow --checked​ after the entry point file name :-)
We would not want using dart2js to generate bogus hints, warnings or whatever.
Reply all
Reply to author
Forward
0 new messages