You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-constructor @unboxed is not compared across interfaces or coercions #9038
Whether a constructor is @unboxed (untagged) is not compared across interfaces or in coercions:
moduleM: {
typet= | @unboxedA(int) | B({x: int})
leta: t
} = {
typet= | A(int) | B({x: int})
leta=A(3)
}
letn=switchM.a { | A(i) =>i | B(_) =>-1 } // -1: the client expects 3, the implementation built {TAG: "A", _0: 3}
The reverse direction is accepted too. So is a coercion between the two representations:
typea= | @unboxedA(int) | B({x: int})
typeb= | A(int) | B({x: int}) | Cletx: b= (A(3): a :> b) // 3 is not a b: matching it gives C
Also, when the @unboxed configurations of two variants differ, the coercion error says the wrong variant is unboxed ("Variant c is unboxed" for the plain one).
Activity
Compare constructor representations in interfaces and coercions alike
Make @unboxed apply to a whole variant only (#9040)