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