Skip to content

Instantly share code, notes, and snippets.

@sigman78
Created August 20, 2013 20:18
Show Gist options
  • Save sigman78/6286715 to your computer and use it in GitHub Desktop.
Save sigman78/6286715 to your computer and use it in GitHub Desktop.
Repro case for TypeError: Error #1034: Type Coercion failed
package experimental {
import flash.display.Sprite;
public class CoercionError extends Sprite {
private var inner:Inner = new Inner();
public function CoercionError() {
test();
}
// to separate bytecode
public function test():void {
// [Fault] exception, information=TypeError: Error #1034:
inner.prop = true;
}
}
}
class Parent {
private var _prop:Boolean;
public function set prop(value:Boolean):void {
this._prop = value;
}
public function get prop():Boolean {
return this._prop;
}
}
// required: marked final
final class Inner extends Parent {
override public function set prop(value:Boolean):void {
/* this one is optional */
if (super.prop == value) {
return;
}
/* --------------------*/
super.prop = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment