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

Implement assert() messages behind a flag on VM #24215

Closed
munificent opened this issue Aug 26, 2015 · 23 comments
Closed

Implement assert() messages behind a flag on VM #24215

munificent opened this issue Aug 26, 2015 · 23 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Milestone

Comments

@munificent
Copy link
Member

This is the VM-specific issue for #24213. That issue has the details.

@munificent munificent added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Aug 26, 2015
@lrhn lrhn self-assigned this Aug 28, 2015
@lrhn
Copy link
Member

lrhn commented Aug 31, 2015

@sethladd
Copy link
Contributor

Thanks @lrhn !

@mit-mit mit-mit added this to the 1.13 milestone Sep 3, 2015
@sethladd
Copy link
Contributor

Now that dart2js has landed (https://codereview.chromium.org/1342213003/) I think we can land the VM patch?

cc @iposva-google

@stereotype441
Copy link
Member

I'm concerned because the spec change (https://codereview.chromium.org/1324933002) hasn't landed yet, and there is an open question about the spec that doesn't seem to have been agreed upon, namely the question of whether assertion messages are required to be strings or can be any object. (I've been holding off on landing the analyzer changes waiting for this question to be resolved). IIRC, the draft spec text currently says that they need to be strings, but the draft VM implementation allows them to be any object. I haven't looked at the dart2js code to see what it does.

Can we get this question answered ASAP so that we don't start landing implementations that disagree with each other?

cc @gbracha

@sethladd
Copy link
Contributor

Thanks @stereotype441 we're not in a rush to land this in the VM so yes, let's ensure we're implementing the right thing. I believe Gilad's spec proposal is indeed what we should be implementing.

@rakudrama
Copy link
Member

On Thu, Sep 17, 2015 at 9:28 AM, Paul Berry notifications@github.com
wrote:

I'm concerned because the spec change (
https://codereview.chromium.org/1324933002) hasn't landed yet, and there
is an open question about the spec that doesn't seem to have been agreed
upon, namely the question of whether assertion messages are required to be
strings or can be any object. (I've been holding off on landing the
analyzer changes waiting for this question to be resolved). IIRC, the draft
spec text currently says that they need to be strings, but the draft VM
implementation allows them to be any object. I haven't looked at the
dart2js code to see what it does.

​The dart2js implementation currently permits the message to be any value.
I have explained in the spec change why I think this is the correct choice

  • we can debate that there.

Can we get this question answered ASAP so that we don't start landing
implementations that disagree with each other?

cc @gbracha https://github.com/gbracha


Reply to this email directly or view it on GitHub
#24215 (comment).

@sethladd
Copy link
Contributor

The DEP met today, and decided that the type annotation on the optional param should be String. Does the CL reflect that?

@lrhn
Copy link
Member

lrhn commented Oct 1, 2015

The DEP met today, and decided that the type annotation on the optional
param should be String. Does the CL reflect that?

As commented on the dart2js bug, there are no type annotations on assert
statements.

There is no added runtime type-check on the second operand.
I guess one could be added by rewriting the second operand to
(messageExpression) as String .

@lrhn
Copy link
Member

lrhn commented Oct 1, 2015

As commented on the dart2js bug, there are no type annotations on assert
statements.

There is no added runtime type-check on the second operand.
I guess one could be added by rewriting the second operand to
(messageExpression) as String .

Whoops, no. If we are talking type annotation, the rewrite should only be
used in checked mode, in unchecked mode it makes no difference (which also
means that the code needs to run for any object anyway, so why bother?).

@stereotype441
Copy link
Member

Whoops, no. If we are talking type annotation, the rewrite should only be
used in checked mode, in unchecked mode it makes no difference (which also
means that the code needs to run for any object anyway, so why bother?).

However, the behavior in checked mode is the only behavior that matters because assertion failures only happen in checked mode. Quoting from the proposed spec text in https://codereview.chromium.org/1324933002:

The definition above implies that if $s$ does not evaluate to a \cd{String}, a dynamic error is
thrown, because the argument to the constructor of \cd{AssertionError} is typed as \cd{String} and we
are running in checked mode.

@lrhn
Copy link
Member

lrhn commented Oct 1, 2015

Good point, checked mode only.

That also makes it even more clear that checking the operand as by a type assertion is the wrong thing to do. It risks throwing again in the middle of an assertion, dropping the original assertion error. I can't see any case where a user wants that.

If the real goal is just to have a static type check of the operand (as the draft CL actually writes), then the VM implementation should not be affected at all, and in practice all values must be accepted.

@sethladd sethladd modified the milestones: 1.14, 1.13 Oct 1, 2015
@sethladd
Copy link
Contributor

sethladd commented Oct 1, 2015

Bumping to 1.14, not a critical 1.13 thing.

@kevmoo kevmoo modified the milestones: 1.14, 1.15 Jan 13, 2016
@mit-mit
Copy link
Member

mit-mit commented Mar 2, 2016

Clearing out 1.15 milestone as the last full push to dev has happened. If any changes are required before 1.15 is shipped, please file a merge request

@mit-mit mit-mit modified the milestones: 1.16, 1.15 Mar 2, 2016
@mit-mit mit-mit modified the milestones: 1.17, 1.16 Apr 21, 2016
@mit-mit
Copy link
Member

mit-mit commented Apr 21, 2016

Bumping to 1.17

@kevmoo kevmoo removed this from the 1.17 milestone May 20, 2016
@dgrove dgrove added this to the 1.50 milestone Oct 20, 2016
@dgrove dgrove assigned a-siva and unassigned lrhn Oct 20, 2016
@dgrove
Copy link
Contributor

dgrove commented Nov 11, 2016

@a-siva any updates on this?

mhausner added a commit that referenced this issue Dec 9, 2016
Add flag --assert-message to control the feature.

Fixes issue #24215
BUG= http://dartbug.com/24215

This replaces Lasse’s CL  1307363005

patch from issue 1307363005 at patchset 140001 (http://crrev.com/1307363005#ps140001)

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2564623003 .
@munificent
Copy link
Member Author

Hey, @mhausner, does that commit mean this is done? Can I close the bug?

@mhausner
Copy link
Contributor

This is done.

@munificent
Copy link
Member Author

🤘

@munificent
Copy link
Member Author

After writing that comment, I noticed the CL was reverted. Did it get re-reverted? "Deverted"?

@mhausner
Copy link
Contributor

I had to revert it because the corner case where both assert parameters are await expressions did not do the right thing. Still working on a fix.

@mhausner mhausner reopened this Dec 13, 2016
@mit-mit mit-mit modified the milestones: 1.22, 1.50 Dec 14, 2016
@mit-mit
Copy link
Member

mit-mit commented Dec 14, 2016

Moving to 1.22, we need to get this completed.

mhausner added a commit that referenced this issue Dec 14, 2016
Add flag --assert-message to control the feature.

BUG=#24215
R=regis@google.com

Review-Url: https://codereview.chromium.org/2574003003 .
@mhausner
Copy link
Contributor

Should be done now.

@munificent
Copy link
Member Author

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

10 participants