Semantic Diff

#9096 Keep attributes in front of type declarations in created interfaces

1 commit

52ae04551289fd7ef02b4978d2c1a870dc469ac5..pr-9096

cbc96b23e · cknitt + Claude · Oct 28, 2026, 09:56 UTC

Keep attributes in front of type declarations in created interfaces

Why

Create interface copies a type declaration from the source starting at the declaration's location, which begins at type, after the attributes written in front of it. They were replaced by spaces, so @tag and @unboxed declarations got an interface whose runtime representation differs from the implementation's, and doc comments were lost. The copy now starts at the first of those attributes.

modifiedDiagnostic create interface

@tag("kind") type tagged = A(int) | B({x: int}) /** A documented type */type documented = int
rescript
Before
After
type tagged = A(int) | B({x: int}) @tag("kind") type tagged = A(int) | B({x: int})/** A documented type */type documented = inttype documented = int