mirror of
https://github.com/vlang/v.git
synced 2025-09-12 00:46:55 -04:00
This commit is contained in:
parent
c9df064407
commit
e0207b6830
@ -129,9 +129,11 @@ pub fn (mut c Checker) lambda_expr_fix_type_of_param(mut node ast.LambdaExpr, mu
|
|||||||
v.expr = ast.empty_expr
|
v.expr = ast.empty_expr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if pident.kind != .blank_ident {
|
||||||
c.ident(mut pident)
|
c.ident(mut pident)
|
||||||
pident.obj.typ = ptype
|
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) {
|
pub fn (mut c Checker) support_lambda_expr_in_sort(param_type ast.Type, return_type ast.Type, mut expr ast.LambdaExpr) {
|
||||||
is_auto_rec := param_type.is_ptr()
|
is_auto_rec := param_type.is_ptr()
|
||||||
|
@ -45,3 +45,12 @@ fn test_fn_with_callback_called_with_lambda_expression() {
|
|||||||
}) == 'a: 10, b: 20'
|
}) == 'a: 10, b: 20'
|
||||||
assert doit(100, 200, |a, b| 'a: ${a}, b: ${b}') == 'a: 100, b: 200'
|
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