type t = {foo: unit [@a]}
type t = {foo: < .. > [@a] }
The extra space after [@a] in the second case is added to avoid outputting >} which is a keyword. However, it's not necessary to add the protecting space if the object type has an annotation, as is the case here.
The same is also true of:
- inline record types in variants
- polymorphic variants (the token
>] has the same problem)
- class parameter lists (weird, since parentheses are added in this case)
type t = A of {foo: unit [@a]}
type t = A of {foo: < .. > [@a] }
type t = [`Foo of unit]
type t = [`Foo of < .. >[@a] ]
let _ =
object
inherit [b, unit] foo
inherit [b, (< f: unit >[@a]) ] foo
end