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

ObjectMirror#setField return value doesn't match docs #14816

Closed
DartBot opened this issue Nov 5, 2013 · 5 comments
Closed

ObjectMirror#setField return value doesn't match docs #14816

DartBot opened this issue Nov 5, 2013 · 5 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-mirrors

Comments

@DartBot
Copy link

DartBot commented Nov 5, 2013

This issue was originally filed by @seaneagan


From http://api.dartlang.org/docs/bleeding_edge/dart_mirrors/ObjectMirror.html#setField:

If the invocation returns a result r, this method returns the result of calling reflect.

http://api.dartlang.org/docs/bleeding_edge/dart_mirrors/ObjectMirror.html#setField

But it actually just returns the RHS of the setter call.

Example:

class SetterTest {
  set foo(v) => 5;
}

class NoSuchMethodTest {
  noSuchMethod(Invocation invocation) => 5;
}

main() {
  print(new SetterTest().foo = 3);
  print(new NoSuchMethodTest().foo = 3);
}

prints:

3
3

not:

5
5

@DartBot
Copy link
Author

DartBot commented Nov 5, 2013

This comment was originally written by @seaneagan


I guess it should say:

This method returns the result of calling reflect on the result (which is always a) of the invocation.

@dgrove
Copy link
Contributor

dgrove commented Nov 6, 2013

Added Area-Library, Library-Mirrors labels.

@sethladd
Copy link
Contributor

Added Triaged label.

@rmacnak-google
Copy link
Contributor

The intention is that setField mimics the behavior of the base language and returns (a mirror of) the argument. This is implied by the reference to a setter invocation, but the documentation could be more clear.


Set owner to @gbracha.
Added Accepted label.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-mirrors labels Dec 2, 2013
@srawlins
Copy link
Member

srawlins commented Oct 9, 2015

Can be closed?

The docs now say:

... let a be the object bound to value.

If the invocation returns a result r, this method returns the result of calling reflect(value).

However still obtuse, I think this clearly states what setField returns.

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. library-mirrors
Projects
None yet
Development

No branches or pull requests

7 participants