Skip to content

Fix directive @warning("-102") not working#8322

Merged
cknitt merged 2 commits intomasterfrom
warning-102
Apr 24, 2026
Merged

Fix directive @warning("-102") not working#8322
cknitt merged 2 commits intomasterfrom
warning-102

Conversation

@cknitt
Copy link
Copy Markdown
Member

@cknitt cknitt commented Apr 2, 2026

Summary

Fixes #8160, where @warning("-102") did not suppress polymorphic comparison warnings.

Changes

  • Moves warning 102 (Bs_polymorphic_comparison) emission from JS primitive compilation into lambda translation, where warning scopes are available.
  • Allows @warning("-102") on bindings and expressions to suppress polymorphic comparison warnings.
  • Preserves the existing exemption for direct == / != comparisons against null or undefined.
  • Avoids duplicating @ppwarning output while applying warning scopes during translation.
  • Adds a super_errors fixture covering suppression, @ppwarning, null comparison, and an unsuppressed warning.

Testing

  • Added tests/build_tests/super_errors/fixtures/warning102.res
  • Added tests/build_tests/super_errors/expected/warning102.res.expected

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 2, 2026

Open in StackBlitz

rescript

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8322

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: e75a7bd

@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented Apr 2, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f4f487f3f

ℹ️ 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".

Comment thread compiler/ml/translmod.ml Outdated
@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented Apr 2, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 165476741a

ℹ️ 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".

Comment thread compiler/ml/translcore.ml Outdated
@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented Apr 3, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

ℹ️ 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
Copy link
Copy Markdown
Member Author

cknitt commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a937c43f73

ℹ️ 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".

Comment thread compiler/ml/typemod.ml Outdated
Comment thread compiler/ml/typemod.ml Outdated
@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4f4a87c2d

ℹ️ 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".

Comment thread compiler/frontend/bs_ast_invariant.ml Outdated
@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented Apr 24, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ 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 review from cristianoc and zth April 24, 2026 09:34
@cknitt cknitt marked this pull request as ready for review April 24, 2026 09:37
Comment thread compiler/ml/translcore.ml
| {vb_pat = pat; vb_expr = expr; vb_attributes = attr; vb_loc} :: rem ->
let lam = transl_exp expr in
let lam =
Builtin_attributes.warning_scope ~ppwarning:false attr (fun () ->
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What does this do? I'd never heard of @ppwarning: is it used anywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ppwarning emits its string payload as a compiler warning.

Builtin_attributes.warning_scope processes warning-related attributes in a scoped way (@warning, @warnerror, and @ppwarning). Passing ~ppwarning:false keeps the warning/warnerror scoping behavior but suppresses emitting ppwarning messages during this pass, avoiding duplicate warnings when the same attributes have already been processed earlier.

@cknitt cknitt merged commit 4d93364 into master Apr 24, 2026
32 checks passed
@cknitt cknitt deleted the warning-102 branch April 24, 2026 18:47
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.

@warning("-102") doesn't work

2 participants