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

Grammar: is there a reason why a logical/bitwise/equality/etc expression can't be an argument of another similar expression without parentheses? #2258

Closed
DartBot opened this issue Mar 22, 2012 · 7 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug
Milestone

Comments

@DartBot
Copy link

DartBot commented Mar 22, 2012

This issue was originally filed by [email protected]


examples:
1 ^ 2 ^ 3
or 0 == 1 != false

VM parser demands parentheses as would be expected from reading the grammar, but is there a reason why this is not allowed?

@lrhn
Copy link
Member

lrhn commented Mar 23, 2012

It seems to be a bug in the VM's parser.


Added Area-VM, Triaged labels.

@ghost
Copy link

ghost commented Apr 27, 2012

Set owner to @mhausner.

@DartBot
Copy link
Author

DartBot commented Apr 27, 2012

This comment was originally written by @mhausner


The VM implements the grammar as the spec says.

1 ^ 2 ^ 3 is legal and the VM handles it right.

0 == 1 != false is illegal according to spec.

Given the question in the first comment, I'm assigning to Gilad for commenting on why this is so.


Set owner to @gbracha.
Removed Area-VM label.
Added Area-Language label.

@DartBot
Copy link
Author

DartBot commented Apr 29, 2012

This comment was originally written by @seaneagan


as far as chaining comparison operators (< <= == > >=) goes, see issue #1321.

@gbracha
Copy link
Contributor

gbracha commented Apr 29, 2012

Removed Type-Defect label.
Added Type-Enhancement, Accepted labels.

@gbracha
Copy link
Contributor

gbracha commented May 24, 2012

Added this to the M1 milestone.

@gbracha
Copy link
Contributor

gbracha commented Sep 11, 2012

I think we are quite happy to force explicit parentheses in this case, making code very explicit about what is happening: a == b == c could be misinterpreted as a == b && b == c, which it isn't. The difference compared to say, ^, is that the doman and range of the operator agree in logical and bitwise operators, but differs with equality (except for the special case of testing booleans for equality).


Added AsDesigned label.

@DartBot DartBot added Type-Enhancement area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior labels Sep 11, 2012
@DartBot DartBot added this to the M1 milestone Sep 11, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Oct 24, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/f7e9b17..53da3e1):
  53da3e1d  2023-10-23  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#3544)
  62d5469d  2023-10-23  Sam Rawlins  Support extension types in sidebars and categories (#3537)
  69abd0f0  2023-10-22  Sam Rawlins  Refactor file-gathering logic (#3539)
  e9c61d1d  2023-10-22  Sam Rawlins  Convert some late final fields to getters in Accessor, Annotation, Constructor (#3534)
  adcdc8b7  2023-10-20  Parker Lougheed  Update package:lints to v3 (#3542)
  41f02622  2023-10-19  Sam Rawlins  Greatly simplify ModelCommentReference (#3541)
  50e4b679  2023-10-19  Sam Rawlins  Remove use of NodeLocator2 (#3538)
  b2de813c  2023-10-19  Sam Rawlins  Remove support for deprecated leading new in comment references (#3529)
  b350c688  2023-10-19  Sam Rawlins  Bump to 7.0.1 (#3540)
  5256e2fb  2023-10-19  Sam Rawlins  Remove unused warnings (#3533)

lints (https://github.com/dart-lang/lints/compare/975c687..2cf8403):
  2cf8403  2023-10-23  Devon Carew  add no_wildcard_variable_uses; rev to a new major version (#165)
  7b0f556  2023-10-23  Parker Lougheed  Remove mention of no_wildcard_variable_uses from changelog (#164)

matcher (https://github.com/dart-lang/matcher/compare/356e5f6..7512f80):
  7512f80  2023-10-23  Michael Goderbauer  Specify language in neverCalled docs for nicer formatting in docs (#230)

protobuf (https://github.com/dart-lang/protobuf/compare/050c162..3528fad):
  3528fad  2023-10-24  Ömer Sinan Ağacan  Use `setRange` when copying output chunks to the final buffer in `CodedBufferWriter` (#887)

tools (https://github.com/dart-lang/tools/compare/15cc9c7..da6bb18):
  da6bb18  2023-10-24  Elias Yishak  Enum + event constructors added for doctor events (#178)
  e3dd149  2023-10-24  Elias Yishak  Use futures list internally to manage send events (#184)

webdev (https://github.com/dart-lang/webdev/compare/1bd434b..6e324af):
  6e324afb  2023-10-24  Ben Konyi  Add dependency on `package:vm_service_interface` (#2262)
  8429a79f  2023-10-20  Elliott Brooks  Only notify chatroom when daily stable testing fails (#2259)
  3463d169  2023-10-19  Elliott Brooks  Remove Chrome 115 extension error (#2258)
  fdebc06e  2023-10-19  Elliott Brooks  Reset Webdev to 3.2.0-wip after release (#2260)
  9cffb896  2023-10-19  Elliott Brooks  Reset DWDS to 22.1.0-wip after release (#2256)
  07c70c6c  2023-10-19  Elliott Brooks  Prepare Webdev for release to 3.1.0 (#2255)

Change-Id: Ieae3aadcc804a270867d7935b702987cf1f6d51c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332060
Reviewed-by: Elias Yishak <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
This issue was closed.
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-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants