Skip to content
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

Preserve expected type when parsing 'let' expressions #7301

Merged
merged 4 commits into from
Sep 24, 2018

Conversation

ryanhamley
Copy link
Contributor

Launch Checklist

Fixes #7300

@ryanhamley
Copy link
Contributor Author

Confirmed that the error goes away with this change

screen shot 2018-09-19 at 3 26 28 pm

cc: @ChrisLoer @malwoodsantoro

@ChrisLoer
Copy link
Contributor

Awesome! This is a really good candidate for an expression regression test -- you can start from one of the existing "let" tests, and use add a "propertySpec" entry to the test.json to specify the expected type.

@ryanhamley
Copy link
Contributor Author

@ChrisLoer I added a test that's passing. Does that look right to you?

@ChrisLoer
Copy link
Contributor

Yeah, that looks right to me! Did you double-check that the test also fails if you revert your change?

You could probably make the test a little more focused/easier to read by getting rid of the nested interpolate? Just one interpolate expression ought to be enough to exercise the functionality. I've also started trying to annotate some of our render/query/expression tests with a "description" field that describes what's going on in the test (in this case something like "'let' should preserve expected type for child expressions. If it didn't, this test case would fail because the expected "color" type would not get passed into the interpolate and the literal strings wouldn't automatically coerce to the color type").

If you think this is ready for review, I'm ready to 🍏.

@ryanhamley
Copy link
Contributor Author

I simplified the test, added a description and confirmed that the test fails if I revert the change in the let definition.

Copy link
Contributor

@ChrisLoer ChrisLoer left a comment

Choose a reason for hiding this comment

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

🚀

@ryanhamley ryanhamley merged commit 395084c into master Sep 24, 2018
@ryanhamley ryanhamley deleted the let-expected-type branch September 24, 2018 21:53
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.

2 participants