S0027: type mismatch
Generated from rellum-diagnostics/src/db.rs.
Explanation
Every binding, function parameter, match arm, and feedback state has one concrete type. For feedback state, the initial value establishes the state type for all future ticks; every clause must produce that same type so the state slot has a stable layout.
Common causes
- a feedback clause returns a different type than the initial value
- passing an argument whose type does not match the function parameter
- returning different types from match arms
- using a lambda where a non-function type is expected
Canonical fixes
- make the expression produce the expected type
Before:
count: Int ~ feedback(
on press => "one",
0
)
After:
count: Int ~ feedback(
on press => 1,
0
)
- change the annotation or initial value when the new type is intended
Before:
count: Int ~ feedback(
on press => "one",
0
)
After:
count: String ~ feedback(
on press => "one",
"zero"
)
- convert explicitly with a helper such as to_string
Before:
message: String = count
After:
message: String = to_string(count)
Code example
count: Int ~ feedback(
on press => "one",
0
)