Repository navigation
Conversation
The newer generators emit warning-free code (explicit extend declarations, no inexhaustive guards on semantic-value extraction). Regenerated parser.mbt.
- implicit_impl_as_method: add explicit pub extend declarations for the
promoted trait methods, keeping the public API unchanged
- guard_inexhaustive: make the implicit panic explicit with else { panic() }
(including the two guards in parser.mbty)
- deprecated: StringBuilder::new() -> StringBuilder(), Token/ParseError
Show impls call Debug::to_repr(self) instead of the deprecated method
- unused_package: drop unused imports; core/debug in util/diet is test-only
- regenerate parser/lexer.mbt and tests/*.mbt lexers, update snapshot and
pkg.generated.mbti
bobzhang
marked this pull request as ready for review
October 2, 2026 10:35
0.4.4 is the first release with moon.mod. The remaining --deny-warn error is one generated line in parser/parser.mbt (yacc 0.7.23 still emits @list.empty()); it goes away with the next yacc release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Missing gate:
ci.ymlranmoon check/moon -C tests checkwithout--deny-warn(fmt gate already present viamoon fmt && git diff --exit-code).Change:
ci.yml->moon check --deny-warnandmoon -C tests check --deny-warn.Warning fixes (196 warnings -> 0, on every target)
parser/moon.pkg:moonbitlang/yacc@0.7.18->0.7.23,moonbitlang/ulex@0.3.29->0.3.30;codegen/codeblock_parser/moon.pkg:ulex@0.3.29->0.3.30). The newer yacc emits explicitextenddeclarations and no inexhaustive guards, which removes ~60 warnings fromparser/parser.mbt.parser.mbtregenerated;lexer.mbt/codeblock_parser.mbtoutput is unchanged by the ulex bump.pub extend T with Trait::{...}next to each type/impl for exactly the methods the warning lists, so the public API is unchanged (pkg.generated.mbtinow lists these methods; the diff is additions only).Token'sToJson(from the%deriveinparser.mbty, which yacc doesn't extend) is extended in the hand-writtenparser/parser_show.mbt.guard ... else { panic() }, which spells out the panic the guard already did. That includes the two guards in theparser.mbtygrammar actions.StringBuilder::new()->StringBuilder()(incodegen,parser/lexer.mbtxand, in the tests module,jsonlexer.mbtx,bytes.mbtx,lexbuf.mbt; generated lexers regenerated). TheShowimpls ofToken/ParseErrorcallDebug::to_repr(self)instead of the deprecatedto_reprmethod, with the same output.moonbitlang/ulex/regex(root),core/int(codegen, only used inside a string template),util/eof_char_set(dot_tests),util/bounded_enum(util/char_set), and parser's black-box-test-onlycore/test(no black-box tests there; the wbtest import is kept).core/debuginutil/dietmoved to afor "test"import.parser/__snapshot__/spec.jsonupdated: it snapshots the parsedlexer.mbtx, whose embedded code now readsStringBuilder(). Nothing else in it changed.Local verification (moon 0.1.20260920):
moon info --target all/moon fmtleave no diff (root and tests),moon check --deny-warnclean (root, also--target all) andmoon -C tests check --deny-warnclean,moon test38/38 andmoon -C tests test11/11 (same as before).Decisions for review
extends are plainpub(includingDebug::{to_repr}) to keep the API identical. If some of these promotions aren't meant to be public (e.g.to_repr, or the util/automaton internals), you can mark thoseextends#deprecated, or remove them.pub extend Token with ToJson::{to_json}sits in hand-writtenparser_show.mbt, because the yacc%derivedoesn't generate it.else { panic() }is used for the inexhaustive guards to preserve behaviour. Some of these may deserve real error handling.Update for moon 0.1.20261012 / moonc v0.10.15 (added to this PR) — CI stays red until two releases
On the new toolchain neither
masternor this branch can be built: the dependencymoonbitlang/ulex-runtime@0.4.3(the latest published version) ships amoon.mod.json, which is now a hard error ("is no longer supported. Runmoon fmtto migrate").moonbitlang/moonlex-runtimeis already converted on its default branch, but not released yet.Blocked on:
moonbitlang/ulex-runtime(withmoon.mod). Then bump the pin inmoon.modandtests/moon.mod.moonbitlang/yaccwhose runtime template no longer emits@list.empty()(now deprecated in favour ofList([])). Withyacc@0.7.23(the latest) the regeneratedparser/parser.mbthas one such call (line 1674,state_stack), which failsmoon check --deny-warn. Then bump the pin inparser/moon.pkg.What this commit already does, so that only the two pin bumps remain:
moon fmtin the root module and intests/(Int→Int32,UInt→UInt32,x? : T = v→x~ : T = v): formatter output.@list.empty()→@list.List([])in the two grammar actions ofparser/parser.mbty(parser.mbtregenerated by the build rule),x.to_json()→Json(x)inutil/char_set,subset→is_subsetinautomaton.Verified locally by replacing the unpacked
ulex-runtime@0.4.3in.mooncakeswith the converted sources frommoonlex-runtime's default branch (same version, same code; nothing of that is committed):moon info --target allandmoon fmtleave no diff in both modules,moon -C tests check --deny-warnis clean,moon test38/38 andmoon -C tests test11/11 (same as before).moon check --deny-warnin the root module reports exactly one remaining error, the generated line from item 2.Also seen, not changed:
moonprints "excludein moon.mod is deprecated; use.gitignoreor.moonignore" foroptions(exclude: [ "tests" ])in bothmoon.modfiles, and "moon runwasmis deprecated ... usemoonxinstead" for the build rules. Both are notices frommoon, they do not fail the gates.Note: source using
Int32/UInt32needs moon 0.1.20261012 or newer.