Skip to content

fix: translate the rest of a package when the frontend refuses a file - #64

Merged
ylluminate merged 1 commit into
vlang:masterfrom
ylluminate:fix-package-keeps-going
Nov 13, 2026
Merged

ylluminate merged 1 commit into
vlang:masterfrom
ylluminate:fix-package-keeps-going

Conversation

@ylluminate

Copy link
Copy Markdown
Contributor

py2v --package stopped at the first file the frontend couldn't translate and wrote nothing, so one file with a syntax error cost the whole package.

Now that file is not emitted on this run, the other modules are translated, and the skipped files are listed on stderr with the reason (the path in the frontend's message is the absolute one):

Transpiled 2 modules into out
Skipped 1 file(s) that could not be translated:
  bad.py: could not run frontend: SyntaxError in '/path/to/pkg/bad.py': invalid syntax (bad.py, line 1)

If an earlier run wrote V for a file that is skipped now, that old file is removed, so --check can't compile a stale translation; if it can't be removed, the run stops with an error. The exit status is still 1 when a file was skipped. With --check, the generated modules are checked before that final exit.

I ran into it on textual: one of its 247 files fails in the frontend, which left nothing written on master, and 246 files are written with this.

Test plan

  • Two new checks in tests/run_tests.vsh. A package with one good module and one with a syntax error must write the good one, name the bad one, and exit 1. And when a file that translated on a first run is refused on a second, its old output must be gone. Both fail with master's py2v and pass with this change.
  • v tests/run_tests.vsh: 177 passed, 0 failed (175 before, plus the two checks).

@ylluminate
ylluminate merged commit 199e30c into vlang:master Nov 13, 2026
2 checks passed
@ylluminate
ylluminate deleted the fix-package-keeps-going branch November 13, 2026 15:00
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