#E0042: 타입 표기가 필요함
컴파일러가 코드에서 타입을 알아낼 수 없습니다. 빈 리터럴, 아무것도 제약하지 않는 클로저 매개변수, 타입 인자를 정할 것이 없는 제네릭 호출이 그 예입니다. 타입을 쓰세요: let v: List<i32> = [];, |x: i32| .., f::<i32>(..).
nabi
let xs = [];
error[E0042]: type annotations needed: cannot infer the type of `xs` (`List<_>`) from its initializer or later uses - add an annotation naming its arguments (`let xs: List<..> = ..`) --> main.nabi:1:1 | 1 | let xs = []; | ^^^
타입을 쓰세요.
nabi
let xs: List<i32> = [];
println(f"{xs.len()}");
0
관련 코드: E0040 타입 불일치, E0055 여러 타입에 맞는 리터럴
잘못된 곳이 있나요? GitHub에서 이 페이지 고치기. 마지막 수정