v2 / vlib / v / checker / tests / anon_missing_generic_err.out
21 lines · 21 sloc · 1.13 KB · 0b2b06df3c144e02a87ca73813e795454c86ff9f
Raw
1vlib/v/checker/tests/anon_missing_generic_err.vv:8:2: notice: uninitialized `fn` struct fields are not allowed, since they can result in segfaults; use `?fn` or `@[required]` or initialize the field with `=` (if you absolutely want to have unsafe function pointers, use `= unsafe { nil }`)
2 6 |
3 7 | struct Factory {
4 8 | build fn () !
5 | ~~~~~~~~~~~~~
6 9 | }
7 10 |
8vlib/v/checker/tests/anon_missing_generic_err.vv:21:14: error: Add the generic type `E` to the anon fn generic list type, that is currently `[F]`
9 19 | fn use_factory[F, E](factory fn (dep F) !E) Factory {
10 20 | return Factory{
11 21 | build: fn [factory] [F]() ! {
12 | ~~~~~~~
13 22 | mut dep := F{}
14 23 | inject[F](mut dep)!
15vlib/v/checker/tests/anon_missing_generic_err.vv:12:16: error: $for expects a type name or variable name to be used here, but F is not a type or variable name
16 10 |
17 11 | fn inject[T](mut serv T) ! {
18 12 | $for field in T.fields {
19 | ^
20 13 | if field.typ is string {
21 14 | serv.$(field.name) = 'Hello world!'
22