diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2f411c43549..eaa8bbef472 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -8760,7 +8760,7 @@ namespace Parser { if (!jsDocDiagnostics) { jsDocDiagnostics = []; } - jsDocDiagnostics.push(...parseDiagnostics); + addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength); } currentToken = saveToken; parseDiagnostics.length = saveParseDiagnosticsLength; diff --git a/tests/baselines/reference/errorIsolation.symbols b/tests/baselines/reference/errorIsolation.symbols new file mode 100644 index 00000000000..fe35abd73a0 --- /dev/null +++ b/tests/baselines/reference/errorIsolation.symbols @@ -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)) + + /***/ + () => {} +); diff --git a/tests/baselines/reference/errorIsolation.types b/tests/baselines/reference/errorIsolation.types new file mode 100644 index 00000000000..682f1e183c8 --- /dev/null +++ b/tests/baselines/reference/errorIsolation.types @@ -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 + +); diff --git a/tests/cases/conformance/jsdoc/errorIsolation.ts b/tests/cases/conformance/jsdoc/errorIsolation.ts new file mode 100644 index 00000000000..d06d76dcac8 --- /dev/null +++ b/tests/cases/conformance/jsdoc/errorIsolation.ts @@ -0,0 +1,8 @@ +// @noEmit: true +// @checkJs: true +// @filename: errorIsolation.js +const async = { doSomething: _ => {} }; +async.doSomething( + /***/ + () => {} +); \ No newline at end of file