Skip to content

Fix test compile: String.write is no longer a static method - #5

Merged
conorbronsdon merged 1 commit into
mainfrom
fix-string-write
Jul 31, 2026
Merged

Fix test compile: String.write is no longer a static method#5
conorbronsdon merged 1 commit into
mainfrom
fix-string-write

Conversation

@conorbronsdon

Copy link
Copy Markdown
Owner

The test workflow has been red on main since a Mojo nightly bump between 7/29 and 7/31. No source change caused it — the stdlib made String.write an instance method, so both overloads now take mut self and the old static call no longer resolves:

test/test_errors.mojo:15:18: error: no matching function in call to 'write'
note: candidate not viable: value passed to mutable argument 'self' must be mutable
note: candidate not viable: missing required argument: 'value'

String.__init__ takes a variadic pack of Writable args (string.mojo:456) and Error conforms to Writable (error.mojo:138), so String(e) is the direct replacement and writes the same bytes.

Test-only; nothing in src/ used the static form.

Root cause worth noting separately: test.yml installs mojo from the nightly index with --prerelease allow and no version pin, so every run resolves whatever nightly is current. That's why a frozen repo's CI went green → red with no commits in between. Fixing the call site clears today's breakage but not the pattern.

🤖 Generated with Claude Code

Mojo's stdlib made String.write an instance method -- both overloads now take
`mut self` -- so the old static form no longer resolves and the test module
fails to parse:

  test/test_errors.mojo:15:18: error: no matching function in call to 'write'
  note: candidate not viable: value passed to mutable argument 'self' must be mutable

String.__init__ takes a variadic pack of Writable arguments, and Error conforms
to Writable, so String(e) is the direct replacement and produces the same bytes.

Nothing in src/ used the old form; this is test-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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