Issue #1173: Checker: an assignment to a field does not drive the type inference of .collect() (NK1105)

Open and answer this issue on GitHub.

ready · opened 2026-11-02 · updated 2026-11-02 · 0 comments

This came up in the M10 move of check/mod.rs (#125).

self.field = xs.drain().collect() is refused with NK1105. Writing let v: T = xs.drain().collect() and then self.field = v compiles. So the type of the assignment target is not used to infer the type of collect, although the field’s type is known.

To build

  1. In the checker, pass the type of an assignment target as the expected type for the right-hand side, the same way a typed let already does.
  2. Add a test in tests/compiler/: a field assigned from .collect().

Back to Open Issues