Add resolveAliasAsValue to fix a stack overflow#3141
Closed
JsonFreeman wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
i don't like comments like this when they're too long for single line. I'd just put the comment on top of the actual item itself. (nit).
Contributor
Author
There was a problem hiding this comment.
Ok, I put it above and changed it to a doc comment
Contributor
|
Does htis only repro for LS scenarios? Is there a command line exampe that would hit this? |
Contributor
Author
|
I wasn't able to find any command line scenarios for this. I feel like it should be possible to hit in theory, but it's possible the code paths required are not reachable from the command line. |
Contributor
Author
|
Closing in favor of #3160 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2933. The issue is that getTypeOfAlias needs to resolve the alias as a value, which would cause resolveAlias to detect a cycle. However, resolveAlias has no idea that it's looking for a value, so it stops early. This causes getTypeOfAlias to infinitely recurse, and each time it calls resolveAlias, it gets back an alias that is its own target.
The fix is to make a more aggressive resolveAliasAsValue, which will detect the cycle properly. And getTypeOfAlias should call that.
For a more complete explanation, see #3140.