-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.
Description
Describe the bug
Hello, I have another problem related #26191 when passing lambda to the .map() method
Lambda need type hint
Reproduction Steps
check this commit
git clone -b lambda_need_type [email protected]:initdc/types.v.git
cd types.v
v run test.v
or playground: https://play.vlang.io/?query=d1bf7b2789
Expected Behavior
a.map(|x| x.len)) working
Current Behavior
need a type wrapper
fn typed[T, U](f fn (T) U) fn (T) U {
return f
}Possible Solution
No response
Additional Information/Context
https://docs.vlang.io/functions-2.html#lambda-expressions
V version
V 0.5.0 ef05fb1
Environment details (OS name and version, etc.)
|V full version |V 0.5.0 ef05fb1210fcc8cd4c3814627e35b12dcc5b335d
|:-------------------|:-------------------
|OS |linux, Ubuntu 22.04.2 LTS (WSL 2)
|Processor |4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz
|Memory |4.56GB/7.73GB
| |
|V executable |/home/ubuntu/vscode/v/v
|V last modified time|2026-01-04 07:12:29
| |
|V home dir |OK, value: /home/ubuntu/vscode/v
|VMODULES |OK, value: /home/ubuntu/.vmodules
|VTMP |OK, value: /tmp/v_1000
|Current working dir |OK, value: /home/ubuntu/vscode/types.v
| |
|Git version |git version 2.34.1
|V git status |0.5-18-gef05fb12
|.git/config present |true
| |
|cc version |cc (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0
|gcc version |gcc (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0
|clang version |N/A
|tcc version |tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
|tcc git status |thirdparty-linux-amd64 696c1d84
|emcc version |N/A
|glibc version |ldd (Ubuntu GLIBC 2.35-0ubuntu3.11) 2.35
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.
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.