Skip to content

Comments

feat: Emit suggested_replacement with the json error format#5831

Open
Kamirus wants to merge 20 commits intomasterfrom
kamillistopad/lang-1148-make-moc-generate-fixes-for-some-diagnostics
Open

feat: Emit suggested_replacement with the json error format#5831
Kamirus wants to merge 20 commits intomasterfrom
kamillistopad/lang-1148-make-moc-generate-fixes-for-some-diagnostics

Conversation

@Kamirus
Copy link
Contributor

@Kamirus Kamirus commented Feb 10, 2026

Emit machine-applicable code fixes in --error-format json diagnostics for warnings M0223 (redundant type instantiation), M0236 (use dot notation), and M0237 (omit explicit implicit argument). The JSON span format now includes is_primary, label, suggested_replacement, and suggestion_applicability fields, enabling IDEs and tooling to offer automatic fixes

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Comparing from 3ab22a7 to 64d5deb:
The produced WebAssembly code seems to be completely unchanged.
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

Changed the error format type from Classic to Plain in flags.ml and updated related argument parsing in args.ml. Adjusted message printing in diag.ml to reflect the new default error format.
}
type edit = {
at_edit : Source.region;
suggested_replacement : string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is cleaner to have edits separate from spans because there is no priority nor label here.
It's easier to remember when serializing into diagnostics format to handle edits differently

@Kamirus Kamirus marked this pull request as ready for review February 20, 2026 16:30
@Kamirus Kamirus requested a review from a team as a code owner February 20, 2026 16:30
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