File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -189,8 +189,8 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
189
189
if is_decl || is_shared_re_assign {
190
190
// check generic struct init and return unwrap generic struct type
191
191
if mut right is ast.StructInit {
192
+ c.expr (mut right)
192
193
if right.typ.has_flag (.generic) {
193
- c.expr (mut right)
194
194
right_type = right.typ
195
195
}
196
196
} else if mut right is ast.PrefixExpr {
Original file line number Diff line number Diff line change
1
+ struct ClassInfo {
2
+ func fn () = unsafe { nil }
3
+ }
4
+
5
+ pub fn func2 [T]() {
6
+ }
7
+
8
+ pub fn func1 [T]() {
9
+ ci := ClassInfo{
10
+ func: func2 [T]
11
+ }
12
+ ci.func ()
13
+ }
14
+
15
+ struct Struct1 {}
16
+
17
+ struct Struct2 {}
18
+
19
+ fn test_struct_field_init_with_generic_fn () {
20
+ func1 [i32 ]()
21
+ func1 [bool ]()
22
+ func1 [Struct1 ]()
23
+ func1 [Struct2 ]()
24
+ assert true
25
+ }
You can’t perform that action at this time.
0 commit comments