Open sgrekhov opened 5 years ago
I'm not able to reproduce this on master. When I create a file containing exactly the code above I get an error that reads
error • The setter 'id' isn't defined for the extension 'Ext'.
It's possible that the bug has already been fixed.
@bwilkerson, I'm sorry, the description was wrong. There is no this issue in analyzer, but there is an issue in VM. I've updated the issue.
One more example of the wrong error message
class C {
int value;
C() : value = 0 {}
C operator +(int val) {
this.value += val;
return this;
}
}
extension Ext1 on C {
C operator [](int index) => this;
}
extension Ext2 on C {
void operator []=(int index, C other) {
this.value += other.value + index;
}
}
main() {
C c = C();
Ext1(c)[42]++; // Error: The method '[]=' isn't defined for the class 'int'
Ext2(c)[42]++; // Error: The method '[]' isn't defined for the class 'dynamic'.
}
Error messages in an analyzer are correct, but wrong in VM
Analyzer produces
That is correct. But if to run the same code in VM the an error message became confusing
There must be the same error message as in Analyzer " error - The setter 'id' isn't defined for the extension 'Ext'. ", not "... in class 'int'"
dartanalyzer version 2.7.0-dev.0.0 Dart VM version: 2.7.0-dev.0.0 (Tue Nov 5 12:57:33 2019 +0100) on "windows_x64"