mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: add error for .map() calling a fn with multiple return values (prevent inaccessible tuple leak)
This commit is contained in:
@ -1064,10 +1064,10 @@ the `it` built-in variable to achieve a classic `map/filter` functional paradigm
|
||||
```v
|
||||
// using filter, map and negatives array slices
|
||||
a := ['pippo.jpg', '01.bmp', '_v.txt', 'img_02.jpg', 'img_01.JPG']
|
||||
res := a.filter(it#[-4..].to_lower() == '.jpg').map(fn (w string) (string, int) {
|
||||
return w.to_upper(), w.len
|
||||
res := a.filter(it#[-4..].to_lower() == '.jpg').map(fn (w string) string {
|
||||
return w.to_upper()
|
||||
})
|
||||
// [('PIPPO.JPG', 9), ('IMG_02.JPG', 10), ('IMG_01.JPG', 10)]
|
||||
// ['PIPPO.JPG', 'IMG_02.JPG', 'IMG_01.JPG']
|
||||
```
|
||||
|
||||
### Fixed size arrays
|
||||
|
Reference in New Issue
Block a user