| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: strings and bytes |
| #evalPartial |
| -- in.cue -- |
| s0: "foo" + "bar" |
| s1: 3 * "abc" |
| s2: "abc" * 2 |
| |
| b0: 'foo' + 'bar' |
| b1: 3 * 'abc' |
| b2: 'abc' * 2 |
| |
| // TODO: consider the semantics of this and perhaps allow this. |
| e0: "a" + '' |
| e1: 'b' + "c" |
| -- out/def -- |
| s0: "foobar" |
| s1: "abcabcabc" |
| s2: "abcabc" |
| b0: 'foobar' |
| b1: 'abcabcabc' |
| b2: 'abcabc' |
| |
| // TODO: consider the semantics of this and perhaps allow this. |
| e0: _|_ // invalid operation "a" + '' (mismatched types string and bytes) |
| e1: _|_ // invalid operation 'b' + "c" (mismatched types bytes and string) |
| -- out/legacy-debug -- |
| <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))} |
| -- out/compile -- |
| --- in.cue |
| { |
| s0: ("foo" + "bar") |
| s1: (3 * "abc") |
| s2: ("abc" * 2) |
| b0: ('foo' + 'bar') |
| b1: (3 * 'abc') |
| b2: ('abc' * 2) |
| e0: ("a" + '') |
| e1: ('b' + "c") |
| } |
| -- out/eval -- |
| Errors: |
| e0: invalid operands "a" and '' to '+' (type string and bytes): |
| ./in.cue:10:5 |
| ./in.cue:10:11 |
| e1: invalid operands 'b' and "c" to '+' (type bytes and string): |
| ./in.cue:11:5 |
| ./in.cue:11:11 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| s0: (string){ "foobar" } |
| s1: (string){ "abcabcabc" } |
| s2: (string){ "abcabc" } |
| b0: (bytes){ 'foobar' } |
| b1: (bytes){ 'abcabcabc' } |
| b2: (bytes){ 'abcabc' } |
| e0: (_|_){ |
| // [eval] e0: invalid operands "a" and '' to '+' (type string and bytes): |
| // ./in.cue:10:5 |
| // ./in.cue:10:11 |
| } |
| e1: (_|_){ |
| // [eval] e1: invalid operands 'b' and "c" to '+' (type bytes and string): |
| // ./in.cue:11:5 |
| // ./in.cue:11:11 |
| } |
| } |