@@ -181,6 +181,13 @@ suite("DiagnosticsManager Test Suite", async function () {
181
181
) ;
182
182
expectedMainErrorDiagnostic . source = "swiftc" ;
183
183
184
+ const expectedMainDictErrorDiagnostic = new vscode . Diagnostic (
185
+ new vscode . Range ( new vscode . Position ( 15 , 35 ) , new vscode . Position ( 15 , 35 ) ) ,
186
+ "Use [:] to get an empty dictionary literal" ,
187
+ vscode . DiagnosticSeverity . Error
188
+ ) ;
189
+ expectedMainDictErrorDiagnostic . source = "swiftc" ;
190
+
184
191
const expectedFuncErrorDiagnostic : vscode . Diagnostic = new vscode . Diagnostic (
185
192
new vscode . Range ( new vscode . Position ( 1 , 4 ) , new vscode . Position ( 1 , 4 ) ) ,
186
193
"Cannot find 'baz' in scope" ,
@@ -189,7 +196,7 @@ suite("DiagnosticsManager Test Suite", async function () {
189
196
expectedFuncErrorDiagnostic . source = "swiftc" ;
190
197
191
198
const expectedMacroDiagnostic = new vscode . Diagnostic (
192
- new vscode . Range ( new vscode . Position ( 17 , 26 ) , new vscode . Position ( 17 , 26 ) ) ,
199
+ new vscode . Range ( new vscode . Position ( 19 , 26 ) , new vscode . Position ( 19 , 26 ) ) ,
193
200
"No calls to throwing functions occur within 'try' expression" ,
194
201
vscode . DiagnosticSeverity . Warning
195
202
) ;
@@ -238,6 +245,7 @@ suite("DiagnosticsManager Test Suite", async function () {
238
245
[ mainUri . fsPath ] : [
239
246
expectedWarningDiagnostic ,
240
247
expectedMainErrorDiagnostic ,
248
+ expectedMainDictErrorDiagnostic ,
241
249
...( workspaceContext . swiftVersion . isGreaterThanOrEqual (
242
250
new Version ( 6 , 0 , 0 )
243
251
)
@@ -269,7 +277,11 @@ suite("DiagnosticsManager Test Suite", async function () {
269
277
270
278
await Promise . all ( [
271
279
waitForDiagnostics ( {
272
- [ mainUri . fsPath ] : [ expectedWarningDiagnostic , expectedMainErrorDiagnostic ] , // Should have parsed correct severity
280
+ [ mainUri . fsPath ] : [
281
+ expectedWarningDiagnostic ,
282
+ expectedMainErrorDiagnostic ,
283
+ expectedMainDictErrorDiagnostic ,
284
+ ] , // Should have parsed correct severity
273
285
[ funcUri . fsPath ] : [ expectedFuncErrorDiagnostic ] , // Check parsed for other file
274
286
} ) ,
275
287
executeTaskAndWaitForResult ( createBuildAllTask ( folderContext ) ) ,
@@ -282,7 +294,11 @@ suite("DiagnosticsManager Test Suite", async function () {
282
294
283
295
await Promise . all ( [
284
296
waitForDiagnostics ( {
285
- [ mainUri . fsPath ] : [ expectedWarningDiagnostic , expectedMainErrorDiagnostic ] , // Should have parsed correct severity
297
+ [ mainUri . fsPath ] : [
298
+ expectedWarningDiagnostic ,
299
+ expectedMainErrorDiagnostic ,
300
+ expectedMainDictErrorDiagnostic ,
301
+ ] , // Should have parsed correct severity
286
302
[ funcUri . fsPath ] : [ expectedFuncErrorDiagnostic ] , // Check parsed for other file
287
303
} ) ,
288
304
executeTaskAndWaitForResult ( createBuildAllTask ( folderContext ) ) ,
@@ -365,9 +381,22 @@ suite("DiagnosticsManager Test Suite", async function () {
365
381
) ;
366
382
expectedDiagnostic2 . source = "swiftc" ;
367
383
384
+ // Message should not contain [-Wreturn-mismatch] so it can be merged with
385
+ // SourceKit diagnostics if required
386
+ const expectedDiagnostic3 = new vscode . Diagnostic (
387
+ new vscode . Range ( new vscode . Position ( 11 , 4 ) , new vscode . Position ( 11 , 4 ) ) ,
388
+ "Non-void function 'main' should return a value" ,
389
+ vscode . DiagnosticSeverity . Error
390
+ ) ;
391
+ expectedDiagnostic3 . source = "swiftc" ;
392
+
368
393
await Promise . all ( [
369
394
waitForDiagnostics ( {
370
- [ cppUri . fsPath ] : [ expectedDiagnostic1 , expectedDiagnostic2 ] ,
395
+ [ cppUri . fsPath ] : [
396
+ expectedDiagnostic1 ,
397
+ expectedDiagnostic2 ,
398
+ expectedDiagnostic3 ,
399
+ ] ,
371
400
} ) ,
372
401
executeTaskAndWaitForResult ( createBuildAllTask ( cppFolderContext ) ) ,
373
402
] ) ;
0 commit comments