Disable isStartOfType's lookahead when called from isStartOfParameter#18296
Merged
Conversation
mhegazy
reviewed
Sep 7, 2017
| } | ||
|
|
||
| function isStartOfType(): boolean { | ||
| function isStartOfType(disableLookahead?: boolean): boolean { |
Contributor
There was a problem hiding this comment.
can we have a more declarative name, like inJSDocType or something?
mhegazy
reviewed
Sep 7, 2017
| ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts (21 errors) ==== | ||
| var tt1 = (a, (b, c)) => a+b+c; | ||
| ~ | ||
| !!! error TS1003: Identifier expected. |
Contributor
There was a problem hiding this comment.
hmm. so we had this test originally? why did not we catch this the first time around then?
Member
Author
There was a problem hiding this comment.
I noticed the baseline change but (1) I thought that removal of 3 errors was actually an improvement (2) didn't think it was indicative on any further problem. I also looked at the emitted code and thought it was better -- closer to what was written at least.
Contributor
There was a problem hiding this comment.
well.. the new error is a parse error. so a bit worse than the 3 semantic ones.
mhegazy
approved these changes
Sep 7, 2017
Contributor
|
Thanks guys 👍 |
Contributor
|
@sandersn can you port this to release-2.5 as well |
Member
Author
|
It's in release-2.5 now. |
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.
isStartOfTypehas lookahead for parenthesized types. Now that unified JSDoc parsing allows types to start parameters, this lookahead compounds with speculative arrow-function parsing's lookahead (which also cares about parentheses). Disable the lookahead whenisStartOfTypeis called fromisStartOfParameter, which was introduced with the addition of unified JSDoc parsing.Fixes #18123