2
2
import (
3
3
"list"
4
4
"strings"
5
+ "text/template"
5
6
)
6
7
7
8
@@ -87,15 +88,27 @@ badListError: {
87
88
str: strings.Join(x, "")
88
89
}
89
90
91
+ // Issue #1095
92
+ // Preserve combined error severity for multiple errors.
93
+ multipleErrors: {
94
+ #T: {
95
+ params: {
96
+ x: string
97
+ y: string
98
+ }
99
+ out: template.Execute("{{.x}} {{.y}}", params)
100
+ }
101
+ }
102
+
90
103
-- out/eval --
91
104
Errors:
92
105
badListType.decimal: cannot use 2 (type int) as list in argument 1 to list.Max:
93
- ./in.cue:77 :8
106
+ ./in.cue:78 :8
94
107
badListType.str: cannot use 2 (type int) as list in argument 1 to strings.Join:
95
- ./in.cue:77 :8
108
+ ./in.cue:78 :8
96
109
badListError.x: invalid operands 2 and "foo" to '+' (type int and string):
97
- ./in.cue:83:8
98
110
./in.cue:84:8
111
+ ./in.cue:85:8
99
112
100
113
Result:
101
114
(_|_){
@@ -104,67 +117,67 @@ Result:
104
117
Out1: (#list){
105
118
0: (_|_){
106
119
// [cycle] cycle error:
107
- // ./in.cue:16 :23
120
+ // ./in.cue:17 :23
108
121
}
109
122
}
110
123
Out2: (#list){
111
124
0: (_|_){
112
125
// [cycle] cycle error:
113
- // ./in.cue:16 :23
126
+ // ./in.cue:17 :23
114
127
}
115
128
}
116
129
Out3: (#list){
117
130
0: (_|_){
118
131
// [cycle] cycle error:
119
- // ./in.cue:16 :23
132
+ // ./in.cue:17 :23
120
133
}
121
134
}
122
135
Top: (#list){
123
136
0: (_|_){
124
137
// [cycle] cycle error:
125
- // ./in.cue:16 :23
138
+ // ./in.cue:17 :23
126
139
}
127
140
}
128
141
_Sub: (_|_){
129
142
// [incomplete] list1._Sub: undefined field: b:
130
- // ./in.cue:19 :13
143
+ // ./in.cue:20 :13
131
144
}
132
145
a: (struct){
133
146
}
134
147
}
135
148
list2: (struct){
136
149
Out1: (_|_){
137
150
// [cycle] cycle error:
138
- // ./in.cue:30 :21
151
+ // ./in.cue:31 :21
139
152
}
140
153
Out2: (_|_){
141
154
// [cycle] cycle error:
142
- // ./in.cue:30 :21
155
+ // ./in.cue:31 :21
143
156
}
144
157
Out3: (_|_){
145
158
// [cycle] cycle error:
146
- // ./in.cue:30 :21
159
+ // ./in.cue:31 :21
147
160
}
148
161
_Top: (_|_){
149
162
// [cycle] cycle error:
150
- // ./in.cue:30 :21
163
+ // ./in.cue:31 :21
151
164
}
152
165
#Sub: (_|_){
153
166
// [incomplete] list2.#Sub: undefined field: b:
154
- // ./in.cue:33 :13
167
+ // ./in.cue:34 :13
155
168
}
156
169
a: (struct){
157
170
}
158
171
}
159
172
value1: (struct){
160
173
a: (_|_){
161
174
// [incomplete] value1.a: unresolved disjunction 'sf' | 'dd' (type bytes):
162
- // ./in.cue:38 :8
175
+ // ./in.cue:39 :8
163
176
}
164
177
}
165
178
value2: (_|_){
166
179
// [incomplete] value2: unresolved disjunction 'sf' | 'dd' (type bytes):
167
- // ./in.cue:42 :5
180
+ // ./in.cue:43 :5
168
181
}
169
182
incompleteArgDecimalList: (struct){
170
183
a: (#struct){
@@ -176,11 +189,11 @@ Result:
176
189
param: (int){ int }
177
190
transformed: (_|_){
178
191
// [incomplete] incompleteArgDecimalList.#a.transformed: operand param of '+' not concrete (was int):
179
- // ./in.cue:49 :23
192
+ // ./in.cue:50 :23
180
193
}
181
194
max: (_|_){
182
195
// [incomplete] 0: operand param of '+' not concrete (was int):
183
- // ./in.cue:49 :23
196
+ // ./in.cue:50 :23
184
197
}
185
198
}
186
199
}
@@ -194,74 +207,87 @@ Result:
194
207
param: (string){ string }
195
208
transformed: (_|_){
196
209
// [incomplete] incompleteArgStringList.#a.transformed: non-concrete value string in operand to +:
197
- // ./in.cue:58 :22
198
- // ./in.cue:57 :9
210
+ // ./in.cue:59 :22
211
+ // ./in.cue:58 :9
199
212
}
200
213
joined: (_|_){
201
214
// [incomplete] 0: non-concrete value string in operand to +:
202
- // ./in.cue:58 :22
203
- // ./in.cue:57 :9
215
+ // ./in.cue:59 :22
216
+ // ./in.cue:58 :9
204
217
}
205
218
}
206
219
}
207
220
incompleteList: (struct){
208
221
x: (_){ _ }
209
222
decimal: (_|_){
210
223
// [incomplete] incompleteList.decimal: non-concrete list for argument 0:
211
- // ./in.cue:65 :14
224
+ // ./in.cue:66 :14
212
225
}
213
226
str: (_|_){
214
227
// [incomplete] incompleteList.str: non-concrete list for argument 0:
215
- // ./in.cue:66 :14
228
+ // ./in.cue:67 :14
216
229
}
217
230
}
218
231
incompleteListError: (struct){
219
232
x: (_|_){
220
233
// [incomplete] incompleteListError.x: non-concrete value _ in operand to +:
221
- // ./in.cue:70 :8
222
- // ./in.cue:71 :5
234
+ // ./in.cue:71 :8
235
+ // ./in.cue:72 :5
223
236
}
224
237
y: (_){ _ }
225
238
decimal: (_|_){
226
239
// [incomplete] incompleteListError.x: non-concrete value _ in operand to +:
227
- // ./in.cue:70 :8
228
- // ./in.cue:71 :5
240
+ // ./in.cue:71 :8
241
+ // ./in.cue:72 :5
229
242
}
230
243
str: (_|_){
231
244
// [incomplete] incompleteListError.x: non-concrete value _ in operand to +:
232
- // ./in.cue:70 :8
233
- // ./in.cue:71 :5
245
+ // ./in.cue:71 :8
246
+ // ./in.cue:72 :5
234
247
}
235
248
}
236
249
badListType: (_|_){
237
250
// [eval]
238
251
x: (int){ 2 }
239
252
decimal: (_|_){
240
253
// [eval] badListType.decimal: cannot use 2 (type int) as list in argument 1 to list.Max:
241
- // ./in.cue:77 :8
254
+ // ./in.cue:78 :8
242
255
}
243
256
str: (_|_){
244
257
// [eval] badListType.str: cannot use 2 (type int) as list in argument 1 to strings.Join:
245
- // ./in.cue:77 :8
258
+ // ./in.cue:78 :8
246
259
}
247
260
}
248
261
badListError: (_|_){
249
262
// [eval]
250
263
x: (_|_){
251
264
// [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string):
252
- // ./in.cue:83:8
253
265
// ./in.cue:84:8
266
+ // ./in.cue:85:8
254
267
}
255
268
y: (string){ "foo" }
256
269
decimal: (_|_){
257
270
// [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string):
258
- // ./in.cue:83:8
259
271
// ./in.cue:84:8
272
+ // ./in.cue:85:8
260
273
}
261
274
str: (_|_){
262
275
// [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string):
263
- // ./in.cue:83:8
264
276
// ./in.cue:84:8
277
+ // ./in.cue:85:8
278
+ }
279
+ }
280
+ multipleErrors: (struct){
281
+ #T: (#struct){
282
+ params: (#struct){
283
+ x: (string){ string }
284
+ y: (string){ string }
285
+ }
286
+ out: (_|_){
287
+ // [incomplete] error in call to text/template.Execute: cannot convert non-concrete value string:
288
+ // ./in.cue:98:12
289
+ // ./in.cue:95:9
290
+ }
265
291
}
266
292
}
267
293
}
@@ -354,4 +380,13 @@ Result:
354
380
decimal: 〈import;list〉.Max(〈0;x〉)
355
381
str: 〈import;strings〉.Join(〈0;x〉, "")
356
382
}
383
+ multipleErrors: {
384
+ #T: {
385
+ params: {
386
+ x: string
387
+ y: string
388
+ }
389
+ out: 〈import;"text/template"〉.Execute("{{.x}} {{.y}}", 〈0;params〉)
390
+ }
391
+ }
357
392
}
0 commit comments