File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -4278,7 +4278,7 @@ fn (mut g Gen) selector_expr(node ast.SelectorExpr) {
4278
4278
}
4279
4279
alias_to_ptr := sym.info is ast.Alias && sym.info.parent_type.is_ptr ()
4280
4280
if field_is_opt
4281
- || ((node.expr_type.is_ptr () || sym.kind == .chan || alias_to_ptr)
4281
+ || ((g. unwrap_generic ( node.expr_type) .is_ptr () || sym.kind == .chan || alias_to_ptr)
4282
4282
&& node.from_embed_types.len == 0 )
4283
4283
|| (node.expr.is_as_cast () && g.inside_smartcast) {
4284
4284
g.write ('->' )
Original file line number Diff line number Diff line change
1
+ module main
2
+
3
+ struct Foo123 {
4
+ field string = 'foobar'
5
+ }
6
+
7
+ fn gen_func [T](value T) string {
8
+ $if T is i32 {
9
+ return '123'
10
+ } $else $if T is & Foo123 {
11
+ return value.field
12
+ } $else {
13
+ return '123'
14
+ }
15
+ }
16
+
17
+ fn test_main () {
18
+ assert gen_func[& Foo123 ](& Foo123 {}) == 'foobar'
19
+ }
You can’t perform that action at this time.
0 commit comments