mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-28 01:01:53 +03:00
fix array spread type bug
This commit is contained in:
parent
563e3a0d5a
commit
08e90f5c59
@ -1,6 +1,7 @@
|
|||||||
// A spread operator `...` copies the elements of one array into another
|
// A spread operator `...` copies the elements of one array into another
|
||||||
function main(a: [u8; 3]) {
|
function main(a: [u8; 3]) {
|
||||||
let b = [1u8, 1u8];
|
let b = [1u8, 1u8];
|
||||||
|
let c = [1u8, ...b];
|
||||||
|
|
||||||
console.assert(a == [1u8, ...b]);
|
console.assert(a == c);
|
||||||
}
|
}
|
@ -837,7 +837,7 @@ impl Frame {
|
|||||||
|
|
||||||
// Check that the type is an array.
|
// Check that the type is an array.
|
||||||
match array_type {
|
match array_type {
|
||||||
Type::Array(element_type) => Ok(Type::Array(element_type)),
|
Type::Array(element_type) => Ok(*element_type),
|
||||||
type_ => Err(FrameError::invalid_spread(type_, span)),
|
type_ => Err(FrameError::invalid_spread(type_, span)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user