Description
svn r1844
(related to issue #576 and issue #596)
class x {
operator+(x) => 1;
}
foo() => -1;
main() {
print(foo() + "bar");
}
running frogsh on this produces:
TypeError: Object -1 has no method '$add'
at $add (evalmachine.<anonymous>:6:17)
at main (evalmachine.<anonymous>:36:9)
at evalmachine.<anonymous>:38:1
at main (/Users/dgrove/repo/dart-bleeding/dart/frog/frogsh:23536:10)
at Object.<anonymous> (/Users/dgrove/repo/dart-bleeding/dart/frog/frogsh:23918:1)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at Array.<anonymous> (module.js:430:10)
this problem occurs with other operators, as well - if you overload them and then use the operator invalidly, you'll get the wrong sort of exception.
the VM produces:
NoSuchMethodException - receiver: 'bar' function name: 'addFromInteger' arguments: [-1]]
0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:315 col:3
1. Function: 'IntegerImplementation.+' url: 'bootstrap_impl' line:1463 col:32
2. Function: '::.main' url: '/Users/dgrove/repo/dart-bleeding/dart/frog/y.dart' line:8 col:15