Empty class descendant shorthand
- Type: feature
- Track: A
- Status: done
- Owner: —
- Opened: 2026-06-20
- Relation: surfaced by
examples/chessafterSysUtils.Exceptionlanded.
Problem
FPC accepts an empty descendant declaration with a parent and no explicit
end:
EChess = class(Exception);
PXX currently treats this as the start of a class body, consumes following type declarations, and eventually fails later in the type section.
Scope
- In type parsing, accept
T = class(TBase);as a complete empty class declaration. - Keep the existing full form working:
T = class(TBase)
end;
Acceptance
- A focused test can declare
E = class(Exception);fromuses sysutils. examples/chess/chess.pasgets past theEChessdeclaration.- Existing class/inheritance tests still pass.
Log
- 2026-06-20 - Opened after adding the Track B
Exceptionbase class tolib/rtl/sysutils.pas. The chess discovery gap moved from missing base class to this syntax form. - 2026-06-20 - DONE (Track A). parser.inc:
if CurTok.Kind <> tkSemicolonguard wraps the class body while-loop +Expect(tkEnd). Semicolon seen afterclass(TBase)→ skip body entirely, UClsSize still set from curFieldOff.make testgreen, byte-identical self-host. chess.pas now past EChess line (next gap: UpCase RTL). test/test_empty_class_shorthand.pas added.
Resolved-in: 1dd9873 (finalizing commit)