Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgen: fix chan generic code generation #19993

Merged
merged 4 commits into from
Nov 26, 2023

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Nov 25, 2023

Fix #19609

🤖[deprecated] Generated by Copilot at f391db2

Fix a bug in generating C names for generic channels with array types in vlib/v/ast/table.v and add a test case in vlib/v/tests/chan_generic_test.v to verify the fix.

🤖[deprecated] Generated by Copilot at f391db2

  • Fix bug in C name generation for generic channels with array types (link)
  • Add test case for generic channel bug in vlib/v/tests/chan_generic_test.v (link)

@felipensp felipensp marked this pull request as ready for review November 25, 2023 15:42
@@ -924,7 +924,12 @@ pub fn (t &Table) chan_cname(elem_type Type, is_mut bool) string {
} else if elem_type.is_ptr() {
suffix = '_ptr'
}
return 'chan_${elem_type_sym.cname}' + suffix
type_name := if elem_type_sym.cname.contains('[') {
Copy link
Member

Choose a reason for hiding this comment

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

We still support <T> generics so another condition should be added here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not a problem. Have you a test case?

@spytheman spytheman merged commit bc62c5c into vlang:master Nov 26, 2023
38 of 54 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.

Channel instantiation with generic type is failing compilation
3 participants