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 ref and deref when interface as a function parameter(fix #19947) #19966

Merged
merged 1 commit into from Nov 22, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Nov 22, 2023

  1. Fixed Builder error : cannot convert 'struct main__Hittable' to 'struct main__Hittable *' #19947
  2. Add tests.
interface Foo {}

fn main() {
	foo := Foo(1)
	thing(foo)
}

fn thing(src_objects Foo) {
	other_thing(src_objects, src_objects)
}

fn other_thing(a &Foo, b &Foo) {
	dump(a)
	dump(b)
}

outputs:

[a.v:14] a: &Foo(1)
[a.v:15] b: &Foo(1)

@spytheman spytheman merged commit d577e54 into vlang:master Nov 22, 2023
54 checks passed
@shove70 shove70 deleted the deref branch November 22, 2023 13:48
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.

Builder error : cannot convert 'struct main__Hittable' to 'struct main__Hittable *'
2 participants