blob: dd8499cefdef5d6f35673abc850b91c5c55ab0af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Test field access.
// Ref: false
---
// Test field on dictionary.
#let dict = (nothing: "ness", hello: "world")
#test(dict.nothing, "ness")
#{
let world = dict
.hello
test(world, "world")
}
---
// Test fields on elements.
#show list: it => {
test(it.children.len(), 3)
}
- A
- B
- C
---
// Test fields on function scopes.
#enum.item
#assert.eq
#assert.ne
---
// Error: 9-16 function `assert` does not contain field `invalid`
#assert.invalid
---
// Error: 7-14 function `enum` does not contain field `invalid`
#enum.invalid
---
// Error: 7-14 function `enum` does not contain field `invalid`
#enum.invalid()
---
// Closures cannot have fields.
#let f(x) = x
// Error: 4-11 cannot access fields on user-defined functions
#f.invalid
---
// Error: 6-13 dictionary does not contain key "invalid" and no default value was specified
#(:).invalid
---
// Error: 8-10 cannot access fields on type boolean
#false.ok
---
// Error: 25-28 content does not contain field "fun" and no default value was specified
#show heading: it => it.fun
= A
---
// Error: 9-13 cannot access fields on type boolean
#{false.true}
|