Created
August 20, 2013 20:18
-
-
Save sigman78/6286715 to your computer and use it in GitHub Desktop.
Repro case for TypeError: Error #1034: Type Coercion failed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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