A bare variant name is resolved by the expected type, looking through T?, T! and T!E:
fn next(): tok.Tok!Fail = Float(x) builds tok.Tok.Float. Core's Value (Int, Float,
Str, List, ...) is always in scope, so Auk refuses to pick a Value variant silently when the
expected type is another enum without that variant, or when nothing says which type is expected
and an enum of this package has a variant of that name. Write the variant with its module
(tok.Float(x)), give the expected type, or write Value.Float(x) for core's Value.
Wrong#
The project has a module src/tok.auk:
[package]
name = "app"
version = "0.1.0"pub enum Tok { Int(n: int), Float(f: float), Eof }fn main() {
let t = Float(1.5)
print(t)
}Fixed#
fn main() {
let t = tok.Float(1.5)
print(t)
}Common causes#
- A
letwithout a type whose value is a bare variant of another module's enum. - A variant the expected enum doesn't have (a typo, or the wrong enum).