@@ -181,6 +181,13 @@ suite("DiagnosticsManager Test Suite", async function () {
181181 ) ;
182182 expectedMainErrorDiagnostic . source = "swiftc" ;
183183
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+
184191 const expectedFuncErrorDiagnostic : vscode . Diagnostic = new vscode . Diagnostic (
185192 new vscode . Range ( new vscode . Position ( 1 , 4 ) , new vscode . Position ( 1 , 4 ) ) ,
186193 "Cannot find 'baz' in scope" ,
@@ -189,7 +196,7 @@ suite("DiagnosticsManager Test Suite", async function () {
189196 expectedFuncErrorDiagnostic . source = "swiftc" ;
190197
191198 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 ) ) ,
193200 "No calls to throwing functions occur within 'try' expression" ,
194201 vscode . DiagnosticSeverity . Warning
195202 ) ;
@@ -238,6 +245,7 @@ suite("DiagnosticsManager Test Suite", async function () {
238245 [ mainUri . fsPath ] : [
239246 expectedWarningDiagnostic ,
240247 expectedMainErrorDiagnostic ,
248+ expectedMainDictErrorDiagnostic ,
241249 ...( workspaceContext . swiftVersion . isGreaterThanOrEqual (
242250 new Version ( 6 , 0 , 0 )
243251 )
@@ -269,7 +277,11 @@ suite("DiagnosticsManager Test Suite", async function () {
269277
270278 await Promise . all ( [
271279 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
273285 [ funcUri . fsPath ] : [ expectedFuncErrorDiagnostic ] , // Check parsed for other file
274286 } ) ,
275287 executeTaskAndWaitForResult ( createBuildAllTask ( folderContext ) ) ,
@@ -282,7 +294,11 @@ suite("DiagnosticsManager Test Suite", async function () {
282294
283295 await Promise . all ( [
284296 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
286302 [ funcUri . fsPath ] : [ expectedFuncErrorDiagnostic ] , // Check parsed for other file
287303 } ) ,
288304 executeTaskAndWaitForResult ( createBuildAllTask ( folderContext ) ) ,
@@ -365,9 +381,22 @@ suite("DiagnosticsManager Test Suite", async function () {
365381 ) ;
366382 expectedDiagnostic2 . source = "swiftc" ;
367383
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+
368393 await Promise . all ( [
369394 waitForDiagnostics ( {
370- [ cppUri . fsPath ] : [ expectedDiagnostic1 , expectedDiagnostic2 ] ,
395+ [ cppUri . fsPath ] : [
396+ expectedDiagnostic1 ,
397+ expectedDiagnostic2 ,
398+ expectedDiagnostic3 ,
399+ ] ,
371400 } ) ,
372401 executeTaskAndWaitForResult ( createBuildAllTask ( cppFolderContext ) ) ,
373402 ] ) ;
0 commit comments