Skip to content

v: Fix concrete fn type that returns pair type as generic type#17780

Merged
spytheman merged 6 commits intovlang:masterfrom
ChAoSUnItY:concrete_fn_type_as_generic_type
Mar 26, 2023
Merged

v: Fix concrete fn type that returns pair type as generic type#17780
spytheman merged 6 commits intovlang:masterfrom
ChAoSUnItY:concrete_fn_type_as_generic_type

Conversation

@ChAoSUnItY
Copy link
Copy Markdown
Member

concrete_type_as_generic_type_test.v

// ...

fn func_fn_multi_return_concrete() FnMultiReturn[string, string, string] {
	return fn (s string) (string, string) {
		return s[..1], s[1..]
	}
}

fn test_concrete_function_type_as_generic_type() {
	// ...
	s1, s2 := func_fn_multi_return_concrete()('VLang')

	assert s1 == 'V'
	assert s2 == 'Lang'
}

@ChAoSUnItY ChAoSUnItY added Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Unit: Type System Bugs/feature requests, that are related to the V types system. Generics[T] Bugs/feature requests, that are related to the V generics. labels Mar 26, 2023
Copy link
Copy Markdown
Contributor

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Good work.

@spytheman spytheman merged commit 34f5f05 into vlang:master Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Generics[T] Bugs/feature requests, that are related to the V generics. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Unit: Type System Bugs/feature requests, that are related to the V types system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v: concrete pair type cannot use as generic pair type

2 participants