But if I replace the line with the pattern match on the record field by the following:

let { id = id } as t = mk_id ()

then I get a type error:

File "foo.ml", line 9, characters 13-15:
This expression has type float but is here used with type int

It seems strange that adding the "as t" binding, which is not even used, would suddenly make "id" not fully polymorphic anymore, especially since the following, which should be semantically equivalent, works again:

let t = mk_id ()
let { id = id } = t

It is worth pointing out that OCaml 3.09.3 doesn't compile any but the most recent example.

It would be great if type inference in the above cases could be made more predictable and/or general.