X0010 -- Type Mismatch¶
Reserved code:
X0010is not emitted by the current compiler. A type mismatch is reported as T001. This page is kept for continuity.
The compiler expected one type but found another.
Bad Example¶
fn add(a: Int, b: Int) -> Int {
return "hello"; // expected Int, found Str
}
Fix¶
Match the return type to the function's declared return type:
fn add(a: Int, b: Int) -> Int {
return a + b;
}
Notes¶
- Integer literals (
42) default toIntand coerce to any numeric type (UInt8, Float64, etc.) - Use
x as Typefor explicit casts between numeric types.