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

parser: fix shared generic struct as fn parameters(fix #19804) #19805

Merged
merged 3 commits into from
Nov 8, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Nov 7, 2023

  1. Fixed Generic struct can't be used as shared method parameter #19804
  2. Add tests.
struct Test[T] {
	value T
}

fn do_something(shared stuff Test[int]) {
	rlock stuff {
		println(stuff.value)
	}
}

shared test := Test[int]{}

do_something(shared test)

outputs:

0

@shove70 shove70 marked this pull request as ready for review November 8, 2023 00:00
vlib/v/parser/fn.v Outdated Show resolved Hide resolved
@spytheman spytheman merged commit b111a82 into vlang:master Nov 8, 2023
53 of 54 checks passed
@shove70 shove70 deleted the shared branch November 8, 2023 03: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.

Generic struct can't be used as shared method parameter
2 participants