Skip to content

Exclude types originating in literals from recursion depth limiter check #34742

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 4 commits into from
Oct 31, 2019

Conversation

ahejlsberg
Copy link
Member

Fixes #34619.

const symbol = type.symbol;
if (symbol) {
let count = 0;
for (let i = 0; i < depth; i++) {
const t = stack[i];
if (t.flags & TypeFlags.Object && t.symbol === symbol) {
if (t.flags & TypeFlags.Object && t.symbol === symbol && !isObjectOrArrayLiteralType(t)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If two types have the same symbol and one of them is already known not to be an array or object literal type, how could the other possibly be? Under what scenarios does this need to be checked here, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right.

@ahejlsberg
Copy link
Member Author

@typescript-bot run dt
@typescript test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 26, 2019

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 00570a1. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg
Copy link
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 27, 2019

Heya @ahejlsberg, I've started to run the extended test suite on this PR at 00570a1. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg
Copy link
Member Author

RWC tests are clean. DT tests have one new error in tests for mergerino package (7 level deep array literal is now being checked where it wasn't before).

@weswigham
Copy link
Member

Is there a case where there's an object literal type that's provided as an argument to a symbolless generic (indexed access?) thats somehow nonterminating now?

@ahejlsberg
Copy link
Member Author

Don't think so. But if there is, then there is now as well since literals by themselves can't be circular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not reporting error of deep object literal as expected
4 participants