E0066

E0066#

警告名称:prefer_fixed_array

对可变更的数组字面量建议使用 FixedArray

当数组字面量被创建后发生变更时发出此警告。建议使用 FixedArray 更清晰表达意图。

错误示例#

test {
  let xs = [1, 2, 3]
  xs[0] = 4
  inspect(xs[0], content="4")
}

建议#

将数组字面量注解为 FixedArray

test {
  let xs : FixedArray[Int] = [1, 2, 3]
  xs[0] = 4
  inspect(xs[0], content="4")
}