E4029#
This expression has a type which is not a variant.
Erroneous Example#
fn main {
fn f {
(a, b) => a + b
}
let a = f(None)
}
The example above tries to call a function f
with a value None
,
which is a variant of the Option[_]
type, but f
only accepts a tuple,
giving the following error on line 5:
This expression has type (Int, Int), which is a tuple type and not a variant.
Suggestions#
Make sure to use a value of the correct type instead:
fn main {
fn f {
(a, b) => a + b
}
let a = f((3, 4))
}