...
1# DO NOT EDIT; generated by go run testdata/gen.go
2#
3#name: strings and bytes
4#evalPartial
5-- in.cue --
6s0: "foo" + "bar"
7s1: 3 * "abc"
8s2: "abc" * 2
9
10b0: 'foo' + 'bar'
11b1: 3 * 'abc'
12b2: 'abc' * 2
13
14// TODO: consider the semantics of this and perhaps allow this.
15e0: "a" + ''
16e1: 'b' + "c"
17-- out/def --
18s0: "foobar"
19s1: "abcabcabc"
20s2: "abcabc"
21b0: 'foobar'
22b1: 'abcabcabc'
23b2: 'abcabc'
24
25// TODO: consider the semantics of this and perhaps allow this.
26e0: _|_ // invalid operation "a" + '' (mismatched types string and bytes)
27e1: _|_ // invalid operation 'b' + "c" (mismatched types bytes and string)
28-- out/legacy-debug --
29<0>{s0: "foobar", s1: "abcabcabc", s2: "abcabc", b0: 'foobar', b1: 'abcabcabc', b2: 'abcabc', e0: _|_(("a" + ''):invalid operation "a" + '' (mismatched types string and bytes)), e1: _|_(('b' + "c"):invalid operation 'b' + "c" (mismatched types bytes and string))}
30-- out/compile --
31--- in.cue
32{
33 s0: ("foo" + "bar")
34 s1: (3 * "abc")
35 s2: ("abc" * 2)
36 b0: ('foo' + 'bar')
37 b1: (3 * 'abc')
38 b2: ('abc' * 2)
39 e0: ("a" + '')
40 e1: ('b' + "c")
41}
42-- out/eval/stats --
43Leaks: 0
44Freed: 9
45Reused: 7
46Allocs: 2
47Retain: 0
48
49Unifications: 9
50Conjuncts: 9
51Disjuncts: 9
52-- out/eval --
53Errors:
54e0: invalid operands "a" and '' to '+' (type string and bytes):
55 ./in.cue:10:5
56 ./in.cue:10:11
57e1: invalid operands 'b' and "c" to '+' (type bytes and string):
58 ./in.cue:11:5
59 ./in.cue:11:11
60
61Result:
62(_|_){
63 // [eval]
64 s0: (string){ "foobar" }
65 s1: (string){ "abcabcabc" }
66 s2: (string){ "abcabc" }
67 b0: (bytes){ 'foobar' }
68 b1: (bytes){ 'abcabcabc' }
69 b2: (bytes){ 'abcabc' }
70 e0: (_|_){
71 // [eval] e0: invalid operands "a" and '' to '+' (type string and bytes):
72 // ./in.cue:10:5
73 // ./in.cue:10:11
74 }
75 e1: (_|_){
76 // [eval] e1: invalid operands 'b' and "c" to '+' (type bytes and string):
77 // ./in.cue:11:5
78 // ./in.cue:11:11
79 }
80}
View as plain text