bynk.consumes.type_not_selected
Error A type (or a bare variant of a sum) of a consumed unit is named in a file whose own consumes does not bring it in: it lists other names, or only another file of the unit consumes the unit.
Imports are per file. A unit's own declarations are shared by all its files, but a name from another unit, a type or a bare variant of one of its sums, is in scope only in a file that itself has a consumes bringing it in, and where the list is braced, only if it is listed. Naming a type that this file's own consumes does not bring in is an error, whether the clause lists other names or only another file of the unit consumes the unit; bynk check --fix=bynk.consumes.type_not_selected adds the name to this file's consumes, or adds one. A bare consumes U, with no braces, brings in all of U's names for that file.
Example
consumes bynk { Logger } // ✗ `TimedOut` is not listed
consumes bynk { Logger, TimedOut } // ✓
fn at(t: TimedOut) -> Bool { true}
// shop/audit.bynk, another file of the same contextfn late(t: TimedOut) -> Bool { // ✗ this file does not consume `bynk` true}
consumes bynk { TimedOut } // ✓ each file consumes what it namesIn the Book
See also
- The grammar rule it governs:
consumes_decl. - Every code in its category, Consumes, on the diagnostic index.
bynk explain bynk.consumes.type_not_selectedshows the same from the installed toolchain, without a network.