Skip to content

Commit 0544ce9

Browse files
committed
cases: test coverage for #11850
Closes #11850
1 parent 8ffa2d7 commit 0544ce9

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
const A = struct { x : i32, };
1+
const A = struct { x: i32 };
22
export fn f() void {
3-
var a : A = undefined;
3+
var a: A = undefined;
44
a.foo = 1;
55
const y = a.bar;
66
_ = y;
77
}
88
export fn g() void {
9-
var a : A = undefined;
9+
var a: A = undefined;
1010
const y = a.bar;
1111
_ = y;
1212
}
13+
export fn e() void {
14+
const B = struct {
15+
fn f() void {}
16+
};
17+
const b: B = undefined;
18+
@import("std").debug.print("{}{}", .{ b.f, b.f });
19+
}
1320

1421
// error
1522
// backend=stage2
1623
// target=native
1724
//
18-
// :4:7: error: no field named 'foo' in struct 'tmp.A'
25+
// :4:7: error: no field named 'foo' in struct 'invalid_struct_field.A'
1926
// :1:11: note: struct declared here
20-
// :10:17: error: no field named 'bar' in struct 'tmp.A'
21-
27+
// :10:17: error: no field named 'bar' in struct 'invalid_struct_field.A'
28+
// :1:11: note: struct declared here
29+
// :18:45: error: no field named 'f' in struct 'invalid_struct_field.e.B'
30+
// :14:16: note: struct declared here

0 commit comments

Comments
 (0)