fix array spread type bug

This commit is contained in:
collin 2020-12-10 17:54:19 -05:00
parent 563e3a0d5a
commit 08e90f5c59
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// A spread operator `...` copies the elements of one array into another
function main(a: [u8; 3]) {
let b = [1u8, 1u8];
let c = [1u8, ...b];
console.assert(a == [1u8, ...b]);
console.assert(a == c);
}

View File

@ -837,7 +837,7 @@ impl Frame {
// Check that the type is an array.
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)),
}
}