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

[VM] Setters cannot conflict with methods #5840

Closed
DartBot opened this issue Oct 12, 2012 · 6 comments
Closed

[VM] Setters cannot conflict with methods #5840

DartBot opened this issue Oct 12, 2012 · 6 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Oct 12, 2012

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


similar bug has been fixed in Analyzer, but VM fails the following co19 tests:
Language/07_Classes/3_Setters_A04_t01
and Language/07_Classes/3_Setters_A04_t02

VM r13590

@tomball
Copy link
Contributor

tomball commented Oct 12, 2012

class C {
  void set foo(value) { }
  foo(value) { }
}

main() {
  C c=new C();
  c.foo(1);
  c.foo=1;
}

Error: line 17 pos 3: field or method 'foo' already defined
  foo(value) { }
  ^

From the language spec: "The name of a setter is obtained by appending the string `=' to the identifier given in its signature. Hence, a setter name can never conflict with, override or be overridden by a getter or method."


Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Oct 15, 2012

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


From what I understand, the '=' character is appended to the setter name internally, for the sake of simplifying lookup
A setter explicitly defined by the user need not include the equals character, as seen in issue #5068, for example

@DartBot
Copy link
Author

DartBot commented Nov 6, 2012

This comment was originally written by @mhausner


We pass these two tests now.


Set owner to @mhausner.
Added Fixed label.

@tomball
Copy link
Contributor

tomball commented Dec 10, 2012

Language/07_Classes/3_Setters_A04_t01 is still failing:

out/DebugIA32/dart ../tests/co19/src/Language/07_Classes/3_Setters_A04_t01.dart
Unhandled exception:
NoSuchMethodError : method not found: 'set:foo'
Receiver: Instance of 'C'
Arguments: [1]
#­0 Object._noSuchMethod (dart:core-patch:1262:3)
#­1 Object.noSuchMethod (dart:core-patch:1265:25)
#­2 main (file:///usr/local/google/home/tball/src/dart-all/dart/tests/co19/src/Language/07_Classes/3_Setters_A04_t01.dart:25:5)


Added Triaged label.

@tomball
Copy link
Contributor

tomball commented Dec 10, 2012

Language/07_Classes/3_Setters_A04_t04 and Language/07_Classes/3_Setters_A04_t05 fail with the same error:

out/DebugIA32/dart ../tests/co19/src/Language/07_Classes/3_Setters_A04_t04.dart
Unhandled exception:
NoSuchMethodError : method not found: 'set:foo'
Receiver: Instance of 'C'
Arguments: [1]
#­0 Object._noSuchMethod (dart:core-patch:1262:3)
#­1 Object.noSuchMethod (dart:core-patch:1265:25)
#­2 main (file:///usr/local/google/home/tball/sr

@DartBot
Copy link
Author

DartBot commented Feb 19, 2013

This comment was originally written by @mhausner


Both co19 tests referenced above are wrong, or I should say expect the wrong outcome. They both define an abstract setter that is then invoked. This will result in a runtime error (not a compile time error). The VM is doing the right thing here.

Filed co19 issue #383.


Added Fixed label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Feb 19, 2013
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.
Projects
None yet
Development

No branches or pull requests

2 participants