JuliaLang/julia — pull request #7684 by carnaval (2014-07-21 11:41:41+00:00)
Title: bring back the more correct fieldtype now supporting integer indexing

This should fix #7681. Inference was allowing fieldtype(_, ::Int) but the builtin function did not support this version. This patch (and the former one) may insert some new runtime calls but for now I don't see another simple way to preserve fieldtype semantics. No measurements were done but if this incurs a slowdown somewhere then the good way around would be to improve inference I guess.
It used to generate incorrect code quite easily :
```
type Foo; x :: Int; end
a = Foo(0)
f() = a.x = 1.0
f()
```
throws an error on master since it only converts 1.0 to Any.