Semantic Diff

#9053 Suggest a coercion to the whole expected type

1 commit

1178cb3a51b731fff2e947d1238f5c10e723857b..pr-9053

61cfc5e9e · cknitt + Claude · Oct 26, 2026, 13:23 UTC

Suggest a coercion to the whole expected type

Why

The "compatible at runtime" hint checked the top-level types but printed the innermost mismatch, so its suggestion didn't compile.

modifiedDiagnostic coercion hint

let consume = (_f: unit => Iterable.t<int>) => ()let make: unit => Generator.t<int, unit, unit> = %raw(`function* () { yield 1 }`)let () = consume(make)
diagnostic
Before
After
- These types are compatible at runtime. You can use the coercion operator to convert to the expected type: (make :> iterable<int>)- These types are compatible at runtime. You can use the coercion operator to convert to the expected type: (make :> unit => Iterable.t<int>)

Fixes #9037