← board

Capital Write/WriteLn rejected in some contexts (compiler self-build), works standalone

Symptom

Adding if DumpCpp then begin Write(Source); Halt(0); end; to compiler.pas (Source: AnsiString) failed the self-build:

pascal26:64157: error: undefined variable (Write)

Lowercasing to write(Source) compiled fine. Only the capitalization changed.

But the same compiler binary accepts capital Write/WriteLn in a standalone program:

program wcase;
var s: AnsiString;
begin
  s := 'hi';
  Write(s); WriteLn('!');   { works: prints hi! }
  write('lower ok'); writeln;
end.

So capital write/writeln resolves in a small program but not in compiler.pas. Same binary, opposite result → context-dependent.

Open question (the crux)

Why does it differ by context? Candidates to check:

Repro

Acceptance

Log