← board

WideChar variable → string: concat segfaults, arg mis-resolves (assign fixed)

Repro

procedure show(const s: AnsiString); begin writeln('arg=', s); end;
var s: AnsiString; w: WideChar;
begin
  w := WideChar($41);
  s := w;            { assign  — FIXED, b1cbd204 (prints A) }
  s := 'x' + w;      { concat  — FIXED, this session (single-sided string+ordinal) }
  show(w);           { arg     — STILL OPEN: compile error "Mismatch in MatchProcCall" }
end.

Remaining: only the ARG/overload case. show(w) (widechar var to a const AnsiString param) fails overload resolution — MatchProcCall does not treat a tyUInt16 arg as string-compatible. Lower-severity than the crashes (a compile error, not a segfault); needs the same widechar-string-compat rule at the call site, or the centralization refactor.

Root (same family, different sites)

WideChar collapses to tyUInt16 with no subtype marker (see the assign bug). The assign path was taught to wrap a tyUInt16 RHS in WrapWideCharToUTF8, but the same conversion is re-decided independently at:

Each site re-implements "is this a char-like value that must become a string?" — exactly the scatter the refactor targets.

Fix

Acceptance

Log