Skip to content

New rest parameter properties error message#9298

Merged
sandersn merged 6 commits into
microsoft:masterfrom
OrangeShark:new-rest-param-error
Jun 23, 2016
Merged

New rest parameter properties error message#9298
sandersn merged 6 commits into
microsoft:masterfrom
OrangeShark:new-rest-param-error

Conversation

@OrangeShark
Copy link
Copy Markdown
Contributor

Fixes #8827

Some baselines unrelated to the changes I made have been modified or even deleted. For example Report an error when compiler-options input is empty object.errors.txt was deleted but I can't seem to locate the test even in master.

@msftclas
Copy link
Copy Markdown

Hi @OrangeShark, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, MSBOT;

@sandersn
Copy link
Copy Markdown
Member

I noticed the extra, bogus baselines too. Just take them out of the PR for now while we figure out how they got there.

@OrangeShark OrangeShark force-pushed the new-rest-param-error branch from f1debcb to 6a4400a Compare June 21, 2016 23:08
@OrangeShark
Copy link
Copy Markdown
Contributor Author

@sandersn Okay, I took them out and updated the pull request.

~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
function a3(...b?) { } // Error, can't be optional
~
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why wasn't this an error before? weird.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked the git history and they never had an error when they were added. Seems it has something to do with the other bogus baselines. They have always outputted the correct error in the compiler.

@sandersn
Copy link
Copy Markdown
Member

Looks good except for a minor comment change in the baseline.
Plus there is the mystery of the previously-missing error message for ...arg?. Maybe the parser change somehow fixed it in passing?

@OrangeShark
Copy link
Copy Markdown
Contributor Author

I changed the comment. I also believe the reason for the previously missing error message for ...arg? was because the error was from the checker while the previous error of having a parameter property for rest parameters was from the parser. Now that the error is discovered in the checker, it now shows other error messages from the checker.

For example compiling this

function a3(...b?) {}

class C {
    constructor(public ...temp) {}
}

only prints error TS1005: ',' expected. currently.

@sandersn
Copy link
Copy Markdown
Member

👍

@sandersn
Copy link
Copy Markdown
Member

@RyanCavanaugh or @DanielRosenwasser can you take a look at the wording of the new error messages? I want to get another pair of eyes besides mine.

@DanielRosenwasser
Copy link
Copy Markdown
Member

This change makes me happy 💯. We're just waiting on the Travis Build before we merge right now.

@sandersn sandersn merged commit 3f6010c into microsoft:master Jun 23, 2016
@sandersn
Copy link
Copy Markdown
Member

Thanks again, @OrangeShark.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants