Skip to content

Commit cc7946c

Browse files
committed
add test
1 parent 7ce35ad commit cc7946c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
discard """
2+
cmd: '''nim check --hints:off $file'''
3+
action: reject
4+
nimout: '''
5+
tundeclared_field.nim(25, 12) Error: undeclared field: 'bad' for type tundeclared_field.A [type declared in tundeclared_field.nim(22, 8)]
6+
tundeclared_field.nim(30, 16) Error: undeclared field: 'bad' for type tundeclared_field.A [type declared in tundeclared_field.nim(28, 8)]
7+
tundeclared_field.nim(36, 4) Error: undeclared field: 'bad' for type tundeclared_field.A [type declared in tundeclared_field.nim(33, 8)]
8+
tundeclared_field.nim(40, 13) Error: cannot instantiate Foo [type declared in tundeclared_field.nim(39, 8)]
9+
'''
10+
"""
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
# line 20
21+
block:
22+
type A = object
23+
a0: int
24+
var a: A
25+
discard a.bad
26+
27+
block:
28+
type A = object
29+
a0: int
30+
var a = A(bad: 0)
31+
32+
block:
33+
type A = object
34+
a0: int
35+
var a: A
36+
a.bad = 0
37+
38+
block:
39+
type Foo[T: SomeInteger] = object
40+
var a: Foo[float]

0 commit comments

Comments
 (0)