Starter tasks
Ten small, concrete tasks found by reading the code, each reproduced against 0.3.1 with build/moxy. They don't need compiler internals beyond the one file named. Say in the issue that you're taking one so two people don't do the same work. CONTRIBUTING.md explains how to build and test.
These are listed here because creating issues is a maintainer step. When a task becomes a GitHub issue, label it good first issue and link back to this line.
Tests for diagnostics that have none
docs/errors.md documents these messages, and tests/fail/ has no test for any of them (it covers 11 diagnostics). A test is a .mxy file in tests/fail/ and a .err file next to it with the message. Copy tests/fail/addnumber.mxy and .err as a template.
strings are immutable; build a new string instead:src/sema/expr.mxy:234. Reproduce withstring s = "abc"; s[0] = (char)120;.weak fields must hold a ref structandstruct 'N' cannot contain itself:src/sema/decl.mxy:194and:196. Two tests:struct P { int v; } struct A { weak P p; }(aweak int x;is a syntax error instead) andstruct N { int v; N next; }.main must return void or intandfunction 'f' is defined twice:src/sema/decl.mxy:247and:51. The second also prints a note pointing at the first definition; the test should check the note.cannot infer the element type of an empty list:src/sema/expr.mxy:362. Reproduce withauto xs = [];. The message is followed by a hint (line 363); check that too.
Standard library bugs
Each has a one-line reproduction. Fix it and add a test under tests/ (see item 9).
pow_intignores a negative exponent and overflows silently:std/math.mxy:34.pow_int(2, -1)returns1andpow_int(2, 70)returns0. Decide the behavior (panic on a negative exponent is the simplest; say what you choose for overflow), document it in the file's comment, and test it.runreports success when the command is killed by a signal:std/os.mxy:19.run("kill -9 $$")returns0, because the exit status is taken as(status >> 8) & 255without checkingWIFEXITED. Return128 + signalas shells do, or-1, and document which.reversecorrupts UTF-8:std/string.mxy:24.reverse("héllo")produces invalid bytes because it reverses bytes. Either reverse by code point, or rename and document the byte-wise behavior. It also builds the result with repeated+, which is quadratic.read_linescan't tell a missing file from an empty one:std/io.mxy:29. It returns[]for both. Add aResult<string[]>variant, or make it return the error, and keep the old one only if the docs say what it hides.
Tooling and tests
- Tests for
std/io,std/osandstd/time: nothing undertests/orexamples/includes them;examples/stdlib.mxycoversdebug,math,stringandtestonly. Addtests/std/with a test per module:read_file/write_file/append_fileround trip in a temp file,envandhas_env,runexit codes, andmonotonic_msnever going backwards. Items 5 to 8 can add their tests here too. - Language server completion is missing keywords and the standard library:
tools/moxylsp/lsp.mxy:126. The keyword list hasmatchandinbut notdefer,namespace,using,ref,weak,union,async,doorgoto, and the function list stops at a few ofstd/string.mxyandstd/math.mxy. Add the missing words, and the functions fromstd/io.mxy,std/os.mxyandstd/time.mxy. Keep hover text (lsp.mxy:183onward) in step with what you add.