Skip to content
Playground(another site)

bynk.resolve.reserved_builtin_type

Error A type declaration reuses a compiler-known built-in type name.

The compiler knows a few type names itself, and the type parser reads each one as the built-in wherever it appears in a type. A type declaration that reused one would be shadowed at every use, or fail confusingly there, so the declaration is refused. The names are Asset, BoundaryRejection, Connection, History, HttpResult, List, Map, Query, QueueResult, RequestHeaders, RequestQuery, Set, Stream and TokenClaims. Rename the type. They are reserved in type position only, so a value may still use the word. A constant with such a name is bynk.resolve.name_conflict instead, and the base types and words such as Result are keywords that the parser refuses earlier.

Example

type Set = { items: List[Int] } // ✗ `Set` is the built-in set type
type IntSet = { items: List[Int] } // ✓

In the Book

See also

  • The grammar rule it governs: type_decl.
  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.reserved_builtin_type shows the same from the installed toolchain, without a network.