Skip to content
Playground(another site)

bynk.boundary.ambiguous_type

Error A value's type is declared, with different shapes, by more than one consumed context, so its fields cannot be read.

A context can export a record whose field has a type it does not export. Reading that field through a value you got from it needs the field's type, and if two contexts you consume each declare a type of that name with different shapes, the compiler cannot tell which is meant. Rename one of the two so a name stands for one shape across the contexts you consume.

Example

shop/quotes.bynk
type Amount = { cents: Int }
type Wrap = { inner: Amount }
// shop/other.bynk
type Amount = { dollars: Int }
// shop/till.bynk
consumes shop.quotes
consumes shop.other
let w <- shop.quotes.wrap()
Effect.pure(w.inner.cents) // ✗ which `Amount` is `inner`?
// shop/other.bynk
type Price = { dollars: Int } // ✓ one name, one shape

In the Book

See also

  • Every code in its category, Boundaries, on the diagnostic index.
  • bynk explain bynk.boundary.ambiguous_type shows the same from the installed toolchain, without a network.