test: cover printable typeof on sumtypes#26770
Merged
JalonSolov merged 7 commits intoMar 30, 2026
Merged
Conversation
Collaborator
|
Close/re-open for CI run. |
Collaborator
|
A conflict to resolve, and a problem with |
Contributor
Author
|
Fixed in Verified with |
Collaborator
|
Still failing CI with: |
The compiler rejects bare typeof(expr) as a printable expression, requiring typeof(expr).name instead. Use the already-assigned intermediate variables to print the typeof results. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Trying with 7e62c50 |
medvednikov
pushed a commit
that referenced
this pull request
Apr 4, 2026
* test: cover printable typeof on sumtypes Fixes #26704 * fix: avoid v2 verbose timing gotos * fix: harden v2 staged C replacement * test: cover inline printable typeof on sumtypes * fix: address PR review feedback * fix: use stored typeof result in println to avoid compiler error The compiler rejects bare typeof(expr) as a printable expression, requiring typeof(expr).name instead. Use the already-assigned intermediate variables to print the typeof results. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
typeof(sumtype)as a printable string expressionRoot cause
The original issue was a codegen regression in older compiler builds when
println(typeof(step))was used on a sumtype. The current tree no longer reproduces that failure, but there was no targeted test covering that path.Verification
./vnew -gc none -silent vlib/v/tests/typeof_test.v./vnew -g -o /tmp/issue26704_pr.c /tmp/issue26704_pr.v./vnew -gc none /tmp/issue26704_pr.v && /tmp/issue26704_prFixes #26704