So we see how we specify a type of A as integer and that this information transfers to the tree-il representation. The model here is to add types at the end of the record. This is a minimal try to let you chime in to argue.
Anyway to see the code consider the patches (git diff) that follows the email.