Skip to content

new generic stage: more fixes#26391

Merged
spytheman merged 8 commits into
vlang:masterfrom
Eliyaan:continue5-generics
Jan 19, 2026
Merged

new generic stage: more fixes#26391
spytheman merged 8 commits into
vlang:masterfrom
Eliyaan:continue5-generics

Conversation

@Eliyaan

@Eliyaan Eliyaan commented Jan 19, 2026

Copy link
Copy Markdown
Member
  • fix match branch cloning
  • better support for aliased types
  • support more comptime type conditions
  • fix some failures related to markused

Fixes more tests from v -new-generic-solver test vlib/v/tests/generics/, status : 53 failed, 208 passed, 261 total compared to 69 failed, 192 passed, 261 total for the previous PR

str_fn_name = 'builtin__${str_fn_name}'
}
if sym.has_method_with_generic_parent('str') {
if sym.has_method_with_generic_parent('str') && !g.pref.new_generic_solver {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if sym.has_method_with_generic_parent('str') && !g.pref.new_generic_solver {
if !g.pref.new_generic_solver && sym.has_method_with_generic_parent('str') {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have put it like that to avoid checking for the new solver even if the condition is not valid, as the new solver is not the default path for now. But if you find this clearer, I can change it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking a boolean is faster than doing a fn call, and && does not evaluate its right operand, if the first is false -> it is a good habbit to put the cheap operation on the left side, even if it may not matter much in this case...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh true I did not consider the cost of the fn call. Thank you

Comment thread vlib/v/generics/generics.v
Comment thread vlib/v/generics/generics.v

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.
Thank you @Eliyaan 🙇🏻 .

@spytheman spytheman merged commit f61de59 into vlang:master Jan 19, 2026
88 checks passed
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.

2 participants