Home / Docs / Diagnostics
U0103: Reserved keyword not available in the package's edition
Release v0.4.0
A reserved word is used as a keyword or as a name. The message names the planned area, "reserved for a later edition (laws)" for example, or the Una construct to use instead.
Why Una rejects it
Some words are reserved for features planned in later versions of Una, and others name constructs from other languages that Una expresses differently. Using one as a keyword or as a name is rejected (spec/01 §5). For example, Una has no return: the last expression of a body is its result.
In edition 0.3 the test declaration is written test (ADR 0105), so example at the start of a declaration is U0103 there, "example is written test in edition 0.3". The declaration's body is read as a test's, and editions 0.1 and 0.2 keep example.
How to fix it
- A word reserved for a later version, such as
tableorall, comes with a repair that renames it, the same way at every occurrence in every module of the package, the names animportline lists included:the_table, orTablewhere a kind or capability name is expected, with a number added when any module of the package already has that name (the_table_2). So applying every edit never makes a name refer to another declaration. - In a module path the repair is advice, since the module's file must move too.
- In edition 0.3,
exampleat the start of a declaration comes with the exact rewrite of the keyword thatuna fixapplies.
The repair at a glance
diff
module demo
- pub double(x: Int) -> Int = return x * 2
+ pub double(x: Int) -> Int = x * 2Failing example
una
module demo
pub double(x: Int) -> Int = return x * 2Fixed example
una
module demo
pub double(x: Int) -> Int = x * 2