-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Return type for the []= operator is being ignored #860
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
closed-not-planned
Closed as we don't intend to take action on the reported issue
Comments
Set owner to @sgmitrovic. |
This comment was originally written by [email protected] To update, it appears that the spec will likely evolve to reflect the current behavior, in which case no change would be needed for the vm or dartc. Stay tuned. Removed Area-Language label. |
Added WontFix label. |
DartBot
added
Type-Defect
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
labels
Dec 19, 2011
kevmoo
added
closed-not-planned
Closed as we don't intend to take action on the reported issue
and removed
resolution-wont_fix
labels
Mar 1, 2016
copybara-service bot
pushed a commit
that referenced
this issue
Jul 13, 2023
… native, protobuf, test, tools Revisions updated by `dart tools/rev_sdk_deps.dart`. dartdoc (https://github.com/dart-lang/dartdoc/compare/2522559..d716fa3): d716fa36 2023-07-13 Sam Rawlins Migrate the try-publish and build-pub-package tasks to args commands (#3460) 33b44d2d 2023-07-11 Sam Rawlins Migrate doc-related tasks to package:args commands (#3459) ecosystem (https://github.com/dart-lang/ecosystem/compare/b34db4f..db9d71d): db9d71d 2023-07-12 Devon Carew upgrade to the latest stable action version (#133) 3f4b8d1 2023-07-12 Moritz Switch coverage computation (#132) 5a9f06b 2023-07-10 Jacob MacDonald add environment input to support github deployment environments (#131) f3b10c9 2023-07-10 Kevin Moore blast_repo:auto-publish - add permissions by default (#129) http (https://github.com/dart-lang/http/compare/c148a3a..b206771): b206771 2023-07-11 Brian Quinlan Make native bindings pass `dart analysis` (#985) leak_tracker (https://github.com/dart-lang/leak_tracker/compare/85bd7fb..5675231): 5675231 2023-07-13 Polina Cherkasova Add disconnection from service to free up references. (#91) 9b97f84 2023-07-11 Parker Lougheed Remove mentions to deprecated strong_mode options (#85) a21e90e 2023-07-11 Polina Cherkasova Protect from identityHashCode equal to 0. (#90) 8e3aa07 2023-07-11 Polina Cherkasova Create troubleshooting helpers. (#89) markdown (https://github.com/dart-lang/markdown/compare/b4bdde2..ee4e1b3): ee4e1b3 2023-07-13 Sam Rawlins Bump to 7.1.1 (#550) mockito (https://github.com/dart-lang/mockito/compare/451f756..ffbbb4c): ffbbb4c 2023-07-12 Ilya Yanok Second attempt to fix "not found" error for type vars in bounds native (https://github.com/dart-lang/native/compare/1e89ed9..acad396): acad396 2023-07-11 Daco Harkes [infra] Remove the last path dependencies (#88) protobuf (https://github.com/dart-lang/protobuf/compare/a912f76..d9e8a31): d9e8a31 2023-07-12 Kevin Moore Compiler: generate doc comments (#860) test (https://github.com/dart-lang/test/compare/3429712..a92b5bb): a92b5bb3 2023-07-12 Nate Bosch Remove "compiling" messages (#2063) 4e023035 2023-07-12 Nate Bosch More loosely handle error message from SDK (#2064) tools (https://github.com/dart-lang/tools/compare/af38b2b..765701d): 765701d 2023-07-13 Elias Yishak Enhance log file stats (#117) Change-Id: Ib89e80f8f8963433c4abef953924830634352d86 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313541 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
osa1
pushed a commit
to osa1/sdk
that referenced
this issue
Jul 17, 2023
… native, protobuf, test, tools Revisions updated by `dart tools/rev_sdk_deps.dart`. dartdoc (https://github.com/dart-lang/dartdoc/compare/2522559..d716fa3): d716fa36 2023-07-13 Sam Rawlins Migrate the try-publish and build-pub-package tasks to args commands (dart-lang#3460) 33b44d2d 2023-07-11 Sam Rawlins Migrate doc-related tasks to package:args commands (dart-lang#3459) ecosystem (https://github.com/dart-lang/ecosystem/compare/b34db4f..db9d71d): db9d71d 2023-07-12 Devon Carew upgrade to the latest stable action version (dart-lang#133) 3f4b8d1 2023-07-12 Moritz Switch coverage computation (dart-lang#132) 5a9f06b 2023-07-10 Jacob MacDonald add environment input to support github deployment environments (dart-lang#131) f3b10c9 2023-07-10 Kevin Moore blast_repo:auto-publish - add permissions by default (dart-lang#129) http (https://github.com/dart-lang/http/compare/c148a3a..b206771): b206771 2023-07-11 Brian Quinlan Make native bindings pass `dart analysis` (dart-lang#985) leak_tracker (https://github.com/dart-lang/leak_tracker/compare/85bd7fb..5675231): 5675231 2023-07-13 Polina Cherkasova Add disconnection from service to free up references. (dart-lang#91) 9b97f84 2023-07-11 Parker Lougheed Remove mentions to deprecated strong_mode options (dart-lang#85) a21e90e 2023-07-11 Polina Cherkasova Protect from identityHashCode equal to 0. (dart-lang#90) 8e3aa07 2023-07-11 Polina Cherkasova Create troubleshooting helpers. (dart-lang#89) markdown (https://github.com/dart-lang/markdown/compare/b4bdde2..ee4e1b3): ee4e1b3 2023-07-13 Sam Rawlins Bump to 7.1.1 (dart-lang#550) mockito (https://github.com/dart-lang/mockito/compare/451f756..ffbbb4c): ffbbb4c 2023-07-12 Ilya Yanok Second attempt to fix "not found" error for type vars in bounds native (https://github.com/dart-lang/native/compare/1e89ed9..acad396): acad396 2023-07-11 Daco Harkes [infra] Remove the last path dependencies (dart-lang#88) protobuf (https://github.com/dart-lang/protobuf/compare/a912f76..d9e8a31): d9e8a31 2023-07-12 Kevin Moore Compiler: generate doc comments (dart-lang#860) test (https://github.com/dart-lang/test/compare/3429712..a92b5bb): a92b5bb3 2023-07-12 Nate Bosch Remove "compiling" messages (dart-lang#2063) 4e023035 2023-07-12 Nate Bosch More loosely handle error message from SDK (dart-lang#2064) tools (https://github.com/dart-lang/tools/compare/af38b2b..765701d): 765701d 2023-07-13 Elias Yishak Enhance log file stats (dart-lang#117) Change-Id: Ib89e80f8f8963433c4abef953924830634352d86 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313541 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[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-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
closed-not-planned
Closed as we don't intend to take action on the reported issue
This issue was originally filed by [email protected]
Hello,
It appears that the declared return type and the corresponding
returned value is being ignored, for the []= operator.
For example, if I have:
main() {
Fred fred = new Fred();
int x = 7, y = 23;
String result = (fred[x] = y);
print("Got result $result");
}
class Fred {
String operator []=(int x, int y) {
print("Inside []= operator code, x = $x, y = $y");
return "${x} + ${y} = ${x + y}";
}
}
Using the standalone vm, this program outputs:
Inside []= operator code, x = 7, y = 23
Got result 23
Using dartboard (which I understand is using dartc), it behaves the
same. (and if I enable type checks, it throws a type error when it
tries to assign the result (which expects a String, but which is
actually an int)).
No matter what return type I define for the operator, and no matter
what I actually return with the return statement, the result of:
String result = (fred[x] = y);
Is always y.
So, it's behaving as if it's an ordinary assignment statement, which
is defined in dart to evaluate the RHS value, essentially.
However, for the []= operator, it seems to be perfectly valid to
overload it with an arbitrary return type, and set it to return a
value, which apparently never gets used.
The spec doesn't appear to define anything about this, I had originally
assumed this might be an issue with the spec not describing this
operator has having some special interpretation, but apparently not.
Jason
The text was updated successfully, but these errors were encountered: