-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
The V compiler reports an error:
error: generic type name 'bool' is not mentioned in interface 'IProp_r'
when defining a method in a generic interface that uses a function type (fn(...)) where one of the parameter types is a concrete type (bool) not related to the interface's generic parameter [T].
This appears to be incorrect behavior, as the concrete type bool is not intended to be a generic parameter — it should be treated as a fixed type in the signature, similar to how concrete types are allowed in generic struct fields or non-generic functions.
Reproduction Steps
pub type Action[A, B] = fn(v1 A, v2 B)
pub interface IProp_r[T]
{
listen_state(action Action[T, bool]) // error: generic type name `bool` is not mentioned in interface `IProp_r`
}
fn main(){
}Expected Behavior
compiling without errors
Current Behavior
error
generic type name bool is not mentioned in interface IProp_r
Possible Solution
No response
Additional Information/Context
The same code compiles fine in golang.
package main
type Action[A any, B any] func(v1 A, v2 B)
type IProp_r[T any] interface {
ListenState(action Action[T, bool])
}
func main() {
}V version
V 0.4.12 087a1c2
Environment details (OS name and version, etc.)
| V full version | V 0.4.12 26305ec.087a1c2 |
|---|---|
| OS | windows, Microsoft Windows 10 Pro 19045 64-bit |
| Processor | 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz |
| Memory | 51.21GB/63.94GB |
| V executable | C:\PORTABLE\DEVELOP\V\VProject_internal\v\v.exe |
| V last modified time | 2025-12-30 13:33:04 |
| V home dir | OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal\v |
| VMODULES | OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal_z\u.vmodules |
| VTMP | OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal_z\t\v_0 |
| Current working dir | OK, value: C:\PORTABLE\DEVELOP\V\VProject\master |
| Git version | git version 2.50.1.windows.1 |
| V git status | weekly.2025.01-2-g087a1c23 |
| .git/config present | true |
| cc version | N/A |
| gcc version | gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r4) 15.2.0 |
| clang version | N/A |
| msvc version | N/A |
| tcc version | tcc version 0.9.27 (x86_64 Windows) |
| tcc git status | N/A |
| emcc version | N/A |
| glibc version | N/A |
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.