TypeScript/tests/baselines/reference/typedefScope1.symbols
Nathan Shively-Sanders 3f93d420bf
Fix @typedef/@callback scope (#43682)
JSDoc typedefs don't actually have hosts, because they're not
semantically attached to a declaration. However, the parser still
attaches them to some declaration (or statement), but that declaration
is not related to the typedef.

Previously, delayedBindJSDocTypedefTag used getJSDocHost to walk past
the unrelated declaration, but #41858 correctly started categorising
typedefs as unattached, with no host, so the binder began falling
back to file scope.

The path to skip the unrelated declaration is always the same, though, so this
PR uses `typeAlias.parent.parent` instead of `getJSDocHost(typeAlias)`.
2021-04-14 16:56:37 -07:00

24 lines
538 B
Plaintext

=== tests/cases/conformance/jsdoc/typedefScope1.js ===
function B1() {
>B1 : Symbol(B1, Decl(typedefScope1.js, 0, 0))
/** @typedef {number} B */
/** @type {B} */
var ok1 = 0;
>ok1 : Symbol(ok1, Decl(typedefScope1.js, 3, 7))
}
function B2() {
>B2 : Symbol(B2, Decl(typedefScope1.js, 4, 1))
/** @typedef {string} B */
/** @type {B} */
var ok2 = 'hi';
>ok2 : Symbol(ok2, Decl(typedefScope1.js, 9, 7))
}
/** @type {B} */
var notOK = 0;
>notOK : Symbol(notOK, Decl(typedefScope1.js, 13, 3))