Skip to content

Fixes crash on chained property access on require #40135

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

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

sandersn
Copy link
Member

From the user tests:

const x = require('y').z.ka

would cause the crash because I forgot to call
getLeftMmostPropertyAccessExpression in one place.

Note that we still get the import wrong, it just stops the crash.

From the user tests:

```js
const x = require('y').z.ka
```

would cause the crash because I forgot to call
getLeftMmostPropertyAccessExpression in one place.

Note that this doesn't fix the alias, it just stops the crash.
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 19, 2020
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Aug 19, 2020

What was the original stack trace? Does this fix any of the issues found by the fuzzer?

@sandersn
Copy link
Member Author

TypeError: Cannot read property '0' of undefined
    at getTargetOfImportEqualsDeclaration (/home/nathansa/ts/built/local/tsc.js:44281:65)
    at getTargetOfAliasDeclaration (/home/nathansa/ts/built/local/tsc.js:44633:28)
    at resolveAlias (/home/nathansa/ts/built/local/tsc.js:44681:30)
    at getSymbol (/home/nathansa/ts/built/local/tsc.js:43338:38)
    at resolveNameHelper (/home/nathansa/ts/built/local/tsc.js:43611:34)
    at resolveName (/home/nathansa/ts/built/local/tsc.js:43595:20)
    at getResolvedSymbol (/home/nathansa/ts/built/local/tsc.js:60627:21)
    at checkIdentifier (/home/nathansa/ts/built/local/tsc.js:62498:26)
    at checkExpressionWorker (/home/nathansa/ts/built/local/tsc.js:69870:28)
    at checkExpression (/home/nathansa/ts/built/local/tsc.js:69820:38)

Where are the issues found by the fuzzer?

@sandersn sandersn merged commit 55ca5e9 into master Aug 19, 2020
@sandersn sandersn deleted the fix-crash-in-chained-propertyaccess-on-require branch August 19, 2020 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants