Skip to content

Compiler throws with "Declaration to checkResolvedBlockScopedVariable is undefined" #27061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
athasach opened this issue Sep 12, 2018 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@athasach
Copy link

TypeScript Version: 3.1.0-dev.20180912

Search Terms:

  • checkResolvedBlockScopedVariable

Code

/**
 * @enum {string} <-- Commenting this out sucessfully compiles
 */
var DICTIONARY: { [key: string]: string } = {
    '&': '&amp;'
};

// Or commenting out this function causes the compilation to succeed.
function lookup(s: string): string {
    return DICTIONARY[s] || "";
}

Expected behavior:

  • Should compile without error.

Actual behavior:

If the @enum {string} comment is removed or if the function is commented out, the compiler will be successful. Otherwise, if the function is present and the @enum {string} is present it will not.

/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:69144
                throw e;
                ^

Error: Debug Failure. Declaration to checkResolvedBlockScopedVariable is undefined
    at checkResolvedBlockScopedVariable (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:25869:33)
    at resolveNameHelper (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:25720:25)
    at resolveName (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:25487:20)
    at getResolvedSymbol (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:35871:21)
    at checkIdentifier (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:37132:26)
    at checkExpressionWorker (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:42140:28)
    at checkExpression (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:42116:42)
    at checkNonNullExpression (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:39149:37)
    at checkIndexedAccess (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:39465:30)
    at checkExpressionWorker (/Users/athasach/dev/research/ts3.1_bug/node_modules/typescript/lib/tsc.js:42168:28)

Playground Link:

https://www.typescriptlang.org/play/index.html#src=%2F**%0D%0A%20*%20%40enum%20%7Bstring%7D%20%3C--%20Commenting%20this%20out%20sucessfully%20compiles%0D%0A%20*%2F%0D%0Avar%20DICTIONARY%3A%20%7B%20%5Bkey%3A%20string%5D%3A%20string%20%7D%20%3D%20%7B%0D%0A%20%20%20%20'%26'%3A%20'%26amp%3B'%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20Or%20commenting%20out%20this%20function%20causes%20the%20compilation%20to%20succeed.%0D%0Afunction%20lookup(s%3A%20string)%3A%20string%20%7B%0D%0A%20%20%20%20return%20DICTIONARY%5Bs%5D%20%7C%7C%20%22%22%3B%0D%0A%7D

Related Issues:

@ghost ghost added Bug A bug in TypeScript Fixed A PR has been merged for this issue labels Sep 13, 2018
@ghost ghost closed this as completed in #27076 Sep 13, 2018
@felixfbecker
Copy link
Contributor

felixfbecker commented Sep 16, 2018

@Andy-MS I am still seeing this error in 3.1.0-dev.20180915

Debug Failure. Declaration to checkResolvedBlockScopedVariable is undefined

    at checkResolvedBlockScopedVariable (node_modules/typescript/lib/typescript.js:31697:33)
    at resolveNameHelper (node_modules/typescript/lib/typescript.js:31538:25)
    at resolveName (node_modules/typescript/lib/typescript.js:31219:20)
    at getResolvedSymbol (node_modules/typescript/lib/typescript.js:43026:21)
    at checkIdentifier (node_modules/typescript/lib/typescript.js:44474:26)
    at checkExpressionWorker (node_modules/typescript/lib/typescript.js:50599:28)
    at checkExpression (node_modules/typescript/lib/typescript.js:50571:42)
    at checkNonNullExpression (node_modules/typescript/lib/typescript.js:47062:37)
    at checkPropertyAccessExpressionOrQualifiedName (node_modules/typescript/lib/typescript.js:47088:28)
    at checkPropertyAccessExpression (node_modules/typescript/lib/typescript.js:47081:20)

@felixfbecker
Copy link
Contributor

felixfbecker commented Sep 17, 2018

I tried all TypeScript versions with a script and found that the error was introduced in 3.1.0-dev.20180906. The last working version was 3.1.0-dev.20180905. Unfortunately, I am depending on a different bug fix from a later version so I cannot downgrade.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants