Circular ref type inference

Hej,

I just notices that, I don’t know if it’s normal behaviour : Try Haxe !
I get { a : Unknown<0> } should be Unknown<0>

class A{
  var a : A;
  public function foo(){
    return {
			a : a.foo()
    }
  }
}

Juts to say, I know how to “solve” that. I’m just asking if compiler couldn’t resolve that by itself… Something like doing a shadow typedef or I don’t know ?

I’m curious about your solution for that, as far as I know it’s not possible for foo to compute a type.

Thanks for your reply Valentin.
The solution is simple : use a typedef like that : Try Haxe !

typedef MyType	= { a : MyType }

class Test {
  static function main() {
    trace("Haxe is great!");
  }
}

class A{
  var a : A;
  public function foo() : MyType{
    return {
			a : a.foo()
    }
  }
}

So I wonder if the compiler couldn’t somehow do this typedef by itself