E4043#
The struct field is defined or matched multiple times.
Erroneous Example#
pub struct S {
a : Int
}
pub let a : Int = match S::{ a: 2, a: 3 } {
{ a: 2, a: 3 } => 4
_ => 5
}
The example above tries to:
Create a struct with the field
adefined multiple times.Destructure a struct with the field
amatched multiple times.
... giving the following error on line 2:
The struct field a is defined several times.
... and the following error on line 3:
The struct field a is matched several times in this pattern.
Suggestion#
Make sure that the struct field is defined or matched only once:
pub struct S {
a : Int
}
pub let a : Int = match S::{ a: 2 } {
{ a: 2 } => 4
_ => 5
}