Hi
I have this error :
Implicit coercion of a value of type X to an unrelated type X
where X is the type of the object and yes it's type X to an unrelated type X
.
It appears 6 times in my project, in 3 differents .mxml file, in the script element. It's in 3 files that I'm not editing and the file I has changing has no link with the 3 files with the errors.
Here a line of code with the problem.
var loadApplicationEvent:LoadApplicationEvent = new LoadApplicationEvent(application);
It was working perfect an when it was compiling and other file that I changed, it put me and error.
Bug from Flash Builder or Flex? Or not?
How can I get ride of it?
I just ran into this issue myself with Flash Builder 4.5. The return type is exactly as it should be.
The solution for me was to do a full rebuild of the project via: Project -> Clean.
I have recently started having this problem with FlashBuilder and here's what I did.
Starting with:
protected var _foo:FooType;
(X) public function get foo():FooType { return this._foo; }
(where (X) is the error in the form Snote described it, with X = FooType)
change to:
protected var _foo:FooType;
public function get foo():* { return this._foo; }
and rebuild. The * type always passes type checking no matter what, so the error disappears.
Then change it back:
protected var _foo:FooType;
public function get foo():FooType { return this._foo; }
The error message then disappears, at least for a while.
So far this technique seems to be reliable, if annoying.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With