diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 092b3ed370..38be51c975 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -2009,7 +2009,7 @@ pub: if base.starts_with('fn ') && p.peek() == .lpar { tmp_typ := p.table.find_type(base) mut f := tmp_typ.func - p.gen('.$field.name') + p.gen('$dot$field.name') p.gen('(') p.check(.name) p.fn_call_args(mut f) diff --git a/vlib/compiler/tests/fn_test.v b/vlib/compiler/tests/fn_test.v index f4498b9cea..5fe4d35580 100644 --- a/vlib/compiler/tests/fn_test.v +++ b/vlib/compiler/tests/fn_test.v @@ -157,6 +157,9 @@ fn test_fn_type_call() { st := MySt{f:test} assert st.f(10) == 1010 + + st1 := &MySt{f:test} + assert st1.f(10) == 1010 }