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

Integer shift operators are not documented #1136

Closed
DartBot opened this issue Jan 11, 2012 · 9 comments
Closed

Integer shift operators are not documented #1136

DartBot opened this issue Jan 11, 2012 · 9 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Jan 11, 2012

This issue was originally filed by ief...@unipro.ru


What steps will reproduce the problem?
consider the following test:

main() {
  int val = 1 << 2147483647;
}

What is the expected output? What do you see instead?
Expected: not sure what, since behavior is not documented
Actual:
Unhandled exception:
NoSuchMethodException - receiver: '2147483647' function name: 'shlFromInt' arguments: [1]]
 0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:356 col:3
 1. Function: 'IntegerImplementation.<<' url: 'bootstrap_impl' line:1505 col:28
 2. Function: '::main' url: '/home/iefremov/dart/co19/trunk/co19/tests/co19/src/LibTest/core/int/operator_lshift/int_operator_lshift_A01_t02.dart' line:17 col:15

The same works for operator >>

What version of the product are you using? On what operating system?
DartVM 3171

Please provide any additional information below.
co19 tests (see rev. 87):
LibTest/core/int/operator_lshift/int_operator_lshift_A01_t02.dart
LibTest/core/int/operator_rshift/int_operator_rshift_A01_t02.dart

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2012

Assigning to Area=language to get the actual behavior specified.


Added Area-Language label.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2012

Issue #1137 has been merged into this issue.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2012

From issue #1137, co19 tests that depend on this issue:
LibTest/core/int/operator_lshift/int_operator_lshift_A01_t02.dart
LibTest/core/int/operator_rshift/int_operator_rshift_A01_t02.dart
LibTest/core/int/operator_lshift/int_operator_lshift_A01_t03.dart
LibTest/core/int/operator_rshift/int_operator_rshift_A01_t03.dart


Added Triaged label.
Changed the title to: "Integer shift operators are not documented".

@DartBot
Copy link
Author

DartBot commented Jan 11, 2012

This comment was originally written by ief...@unipro.ru


Actually, the spec says the following:

A shift expression of the form e1 op e2 is equivalent to the method invocation
e1.op(e2). A shift expression of the form super op e2 is equivalent to the method
invocation super.op(e2).

So it is probably a library issue: corresponding operators should be properly documented.

@floitschG
Copy link
Contributor

I agree that this could be a library issue too.
Afaik we agreed on making 1 << X (for X big) throw an out of memory exception.
However 1 >> X should always work.

@gbracha
Copy link
Contributor

gbracha commented Jan 14, 2012

Moving to libraries and assigning to Josh.


Set owner to jjb@google.com.
Removed Area-Language label.
Added Area-Library, Accepted labels.

@lrhn
Copy link
Member

lrhn commented Jun 3, 2013

I believe the implementation is working correctly now. The VM does throw an out-of-memory error when shifting by too much (when the representation would be too big to fit in the heap, or probably a little before).


Set owner to @lrhn.
Added AssumedStale label.

@ghost
Copy link

ghost commented Jan 16, 2014

Has the documentation be updated? See also co19 issue #129.


cc @floitschG.

@lrhn
Copy link
Member

lrhn commented Jan 17, 2014

The documentation doesn't mention memory overflows (nor should it, it's just another way to run out of memory, just as creating extremely large lists).
It does document what shifting does.
But there is a typo in it: the parameter is 'shiftAmount', but the example code uses 'shiftIndex'.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant labels Jan 17, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

5 participants