a warning would be nice

    import flash.display.Sprite;

    public class Foo extends Sprite {
        public var bar:Object;

        public function Foo() {
            bar = 5;

        public function baz():void {
            var bar:String = "not 5";


What do you think the output is? "not 5", as would be expected. But if you are stupid enough to do something like this (I was, after some refactoring), I would expect the compiler to at least throw a warning. Nope!

Also this is interesting:

public function baz2():void {
    bar = 2;
    var bar:String = "not 2";

does in fact throw this warning:

/Users/greay/projs/Test/Foo.as(19): col: 10 Error: Implicit coercion of a value of type int to an unrelated type String.