Skip to content

Allow formatting semantically invalid source - #4

Merged
konojunya merged 1 commit into
mainfrom
jj/allow-semantic-error-formatting
Sep 3, 2026
Merged

Allow formatting semantically invalid source#4
konojunya merged 1 commit into
mainfrom
jj/allow-semantic-error-formatting

Conversation

@konojunya

Copy link
Copy Markdown
Member

Background

The Task 8 formatter contract requires syntactically valid source with semantic errors to remain formattable. The initial canonical formatter specification incorrectly described every compiler-stage error as a formatting failure, which conflicts with diagnostic-preserving editor and CLI workflows.

Implementation

  • limit formatter rejection to lexical and syntax errors
  • state explicitly that semantic and complexity diagnostics do not prevent formatting
  • require normalized IR equality for valid documents
  • require the portable diagnostic-code set to remain unchanged for syntactically valid documents with semantic or complexity errors

Testing

  • python3 scripts/validate-compiler-diagnostics.py
  • python3 scripts/validate-formatter-fixtures.py
  • JSON Schema metaschema, normalized IR fixture, and diagnostic fixture validation
  • git diff --check

Review focus / concerns

This is a contract correction only; canonical bytes and existing fixtures do not change. Successful formatting still does not claim semantic validity.

@konojunya
konojunya merged commit f382069 into main Sep 3, 2026
1 check passed
@konojunya
konojunya deleted the jj/allow-semantic-error-formatting branch September 3, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant