mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
When attaching JSDoc diagnostics, make sure to only include diagnostics that actually belong with the JSDoc (#57271)
This commit is contained in:
@@ -8760,7 +8760,7 @@ namespace Parser {
|
||||
if (!jsDocDiagnostics) {
|
||||
jsDocDiagnostics = [];
|
||||
}
|
||||
jsDocDiagnostics.push(...parseDiagnostics);
|
||||
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
||||
}
|
||||
currentToken = saveToken;
|
||||
parseDiagnostics.length = saveParseDiagnosticsLength;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/conformance/jsdoc/errorIsolation.ts] ////
|
||||
|
||||
=== errorIsolation.js ===
|
||||
const async = { doSomething: _ => {} };
|
||||
>async : Symbol(async, Decl(errorIsolation.js, 0, 5))
|
||||
>doSomething : Symbol(doSomething, Decl(errorIsolation.js, 0, 15))
|
||||
>_ : Symbol(_, Decl(errorIsolation.js, 0, 28))
|
||||
|
||||
async.doSomething(
|
||||
>async.doSomething : Symbol(doSomething, Decl(errorIsolation.js, 0, 15))
|
||||
>async : Symbol(async, Decl(errorIsolation.js, 0, 5))
|
||||
>doSomething : Symbol(doSomething, Decl(errorIsolation.js, 0, 15))
|
||||
|
||||
/***/
|
||||
() => {}
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/conformance/jsdoc/errorIsolation.ts] ////
|
||||
|
||||
=== errorIsolation.js ===
|
||||
const async = { doSomething: _ => {} };
|
||||
>async : { doSomething: (_: any) => void; }
|
||||
>{ doSomething: _ => {} } : { doSomething: (_: any) => void; }
|
||||
>doSomething : (_: any) => void
|
||||
>_ => {} : (_: any) => void
|
||||
>_ : any
|
||||
|
||||
async.doSomething(
|
||||
>async.doSomething( /***/ () => {}) : void
|
||||
>async.doSomething : (_: any) => void
|
||||
>async : { doSomething: (_: any) => void; }
|
||||
>doSomething : (_: any) => void
|
||||
|
||||
/***/
|
||||
() => {}
|
||||
>() => {} : () => void
|
||||
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
// @noEmit: true
|
||||
// @checkJs: true
|
||||
// @filename: errorIsolation.js
|
||||
const async = { doSomething: _ => {} };
|
||||
async.doSomething(
|
||||
/***/
|
||||
() => {}
|
||||
);
|
||||
Reference in New Issue
Block a user