mirror of
https://github.com/vlang/v.git
synced 2025-09-11 16:36:20 -04:00
This commit is contained in:
parent
c9df064407
commit
e0207b6830
@ -129,8 +129,10 @@ pub fn (mut c Checker) lambda_expr_fix_type_of_param(mut node ast.LambdaExpr, mu
|
||||
v.expr = ast.empty_expr
|
||||
}
|
||||
}
|
||||
c.ident(mut pident)
|
||||
pident.obj.typ = ptype
|
||||
if pident.kind != .blank_ident {
|
||||
c.ident(mut pident)
|
||||
pident.obj.typ = ptype
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (mut c Checker) support_lambda_expr_in_sort(param_type ast.Type, return_type ast.Type, mut expr ast.LambdaExpr) {
|
||||
|
@ -45,3 +45,12 @@ fn test_fn_with_callback_called_with_lambda_expression() {
|
||||
}) == 'a: 10, b: 20'
|
||||
assert doit(100, 200, |a, b| 'a: ${a}, b: ${b}') == 'a: 100, b: 200'
|
||||
}
|
||||
|
||||
// for test params has blank_ident
|
||||
fn f4(g fn (int) string) {
|
||||
assert g(0) == 'hello'
|
||||
}
|
||||
|
||||
fn test_params_has_blank_ident() {
|
||||
f4(|_| 'hello')
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user