Skip to content

List float and bigint in the error for an invalid @as payload - #8987

Open
cknitt wants to merge 1 commit into
masterfrom
drift-8973-as-message
Open

cknitt wants to merge 1 commit into
masterfrom
drift-8973-as-message

Conversation

@cknitt

@cknitt cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member

Fixes #8973.

runtime_tag_of_parsetree accepts float and bigint @as payloads (@as(1.5), @as(12n)), but the error for any other payload left them out:

A variant case annotation @as(...) must be a string, integer, float, bigint, boolean, null, or undefined.

compiler/ml/UntaggedVariants.md quotes the message, so it is updated too. In the same document, the rule 6 table now notes that for arrays and tuples the code prints "an array or tuple type" rather than "a C type".

Tests

The snapshot of UntaggedInvalidVariantAsAnnotation.res is updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe

Why:
    `@as` accepts float and bigint literals, but the error for any other
    payload listed only strings, integers, booleans, null and undefined.
    The untagged variants spec, which quotes the message, now matches it,
    and its rule 6 table gives the wording printed for arrays and tuples.

Diagnostic modified (invalid @as payload):
Example:
    type t = | @as(foo) A | B
Before (diagnostic):
    A variant case annotation @as(...) must be a string, integer, boolean, null, or undefined.
After (diagnostic):
    A variant case annotation @as(...) must be a string, integer, float, bigint, boolean, null, or undefined.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe
@github-actions

Copy link
Copy Markdown

Semantic Diff

1 commit · Full page

List float and bigint in the error for an invalid @as payload

2f2d098 · Christoph Knittel with Claude Opus 5.5 · Oct 23, 2026

Why

@as accepts float and bigint literals, but the error for any other payload listed only strings, integers, booleans, null and undefined. The untagged variants spec, which quotes the message, now matches it, and its rule 6 table gives the wording printed for arrays and tuples.

Diagnostic modified (invalid @as payload)

type t = | @as(foo) A | B

diagnostic

-A variant case annotation @as(...) must be a string, integer, boolean, null, or undefined.
+A variant case annotation @as(...) must be a string, integer, float, bigint, boolean, null, or undefined.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8987

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8987

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8987

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8987

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8987

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8987

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8987

commit: 2f2d098

@github-actions

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review October 23, 2026 09:25
@cknitt

cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T09:30:57.293219Z 2f2d098 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt

cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 2f2d098ad2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt
cknitt requested a review from cristianoc October 23, 2026 09:32
@cknitt
cknitt enabled auto-merge (squash) October 23, 2026 09:32

This branch has not been deployed

No deployments
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.

The @as error message omits float and bigint, which @as accepts

1 participant