Skip to content

fix(compiler): reject unsupported ordering comparisons - #44

Merged
haseebahmed248 merged 1 commit into
haseebahmed248:mainfrom
omergungor11:fix/reject-unsupported-ordering
Sep 6, 2026
Merged

fix(compiler): reject unsupported ordering comparisons#44
haseebahmed248 merged 1 commit into
haseebahmed248:mainfrom
omergungor11:fix/reject-unsupported-ordering

Conversation

@omergungor11

Copy link
Copy Markdown
Contributor

Summary

require true > false else ASSERT currently passes semantic checking, then throws Relational comparison requires numbers or strings at runtime. Reject ordering on booleans, records and lists during compilation with a source-located GS2105 diagnostic.

Related issue

Closes #36

Changes

  • Distinguish ordering from equality after the existing matching-type check; avoid additional diagnostics when an operand is already unknown.
  • Preserve numeric ordering and string-backed String, Url and same-enum ordering. Equality and runtime coercion behavior are unchanged.
  • Cover all four ordering operators against unsupported types and supported values, including runtime evaluation of successful compilation results.
  • Add a diagnostic corpus fixture exercised through both the compiler API and CLI, plus comparison documentation.

Validation

  • npm run check
  • npm run check:generated
  • npm test — 102 tests passed
  • Additional validation is described below.

Additional validation: npm run test:release (4 tests passed) and npm run test:package (111 files, 7 exports and 2 executables verified). Tested locally on Node 22.22.3. Before the compiler fix, the new comparison suite had 13 failing regressions and 24 passing supported-behavior tests; after the fix all passed. No model provider or host effects were needed.

Risk and compatibility

  • Security or permission effects: none; no capability, budget or runtime changes.
  • Compatibility or breaking changes: programs ordering booleans, records or lists now fail checking rather than compiling and throwing at runtime. The IR format and generated contracts are unchanged; existing supported comparisons retain their behavior.

Checklist

  • This change is focused on one issue.
  • Behavioral changes include tests.
  • User-facing behavior and unsupported constructs are documented.
  • Generated files are current.
  • No credentials, private data, or unredacted model output are included.
  • Commits include the required DCO Signed-off-by line.

Implementation and test preparation were assisted by OpenAI Codex; the validation results above were run against this patch.

Signed-off-by: omergungor11 <omergungor99@gmail.com>

@haseebahmed248 haseebahmed248 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @omergungor11, this fixes #36 without changing the supported comparisons. The checks and all 102 tests pass, including the compiler and CLI regressions. CI is green too.

@haseebahmed248
haseebahmed248 merged commit 8f92a3d into haseebahmed248:main Sep 6, 2026
6 checks passed
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.

Reject unsupported ordering comparisons during compilation

2 participants