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

Add the missing @flow annotation #12764

Closed
wants to merge 1 commit into from
Closed

Add the missing @flow annotation #12764

wants to merge 1 commit into from

Conversation

ryerh
Copy link

@ryerh ryerh commented May 8, 2018

Add @flow annotation to packages/react-reconciler/src/ReactFiber.js.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@aweary
Copy link
Contributor

aweary commented May 8, 2018

😮 I'm surprised we didn't catch this earlier. We'll need to fix all the new Flow errors before merging. Do you want to give that a try @ryerh? Happy to help if so.

cc @acdlite

@ryerh
Copy link
Author

ryerh commented May 10, 2018

@aweary I'm willing to contribute😊 I'll try to fix all the new Flow errors and let CI pass, in my free time this week.

But if you do think those errors are urgent, you can just call someone familiar with the code to fix it then close this PR instead.

@ryerh
Copy link
Author

ryerh commented May 13, 2018

Hi @aweary , I have fixed most of the flow errors, but there are three errors remain to be discussed.

They are:

  1. When the code runs to this line ReactFiber.js#L418, the fiberTag variable should have been assigned a proper value rather than null, otherwise an error will be thrown. But flow doesn't known anything about it.
  2. When the code runs to this line ReactFiberScheduler.js#L1081, the nextUnitOfWork should have been assigned a proper value rather than null, otherwise the loop will be breaked. But flow doesn't known anything about it, neither.
  3. ReactFiberScheduler.js#L1085, same as above.

How do we solve them?

@aweary
Copy link
Contributor

aweary commented May 17, 2018

Since this requires some complex decisions to be made about internal types, I'm going to close this in favor of @gaearon's fix in #12842.

Thanks for putting in the work here @ryerh! We appreciate it.

@aweary aweary closed this May 17, 2018
@gaearon
Copy link
Collaborator

gaearon commented May 17, 2018

Sorry, I completely missed this PR and had no idea about this 😞
I independently found it today and am working on #12842.

@aweary If you see something like this next time please ping me directly :-). This is an extremely bad issue and we shouldn’t have missed it.

@gaearon
Copy link
Collaborator

gaearon commented May 17, 2018

@ryerh I'm sorry to duplicate your work. I should've read this PR when I saw it on notifications. I initially thought the PR is just a one-line change (from its title) and didn't look at it, and then forgot about it.

@aweary
Copy link
Contributor

aweary commented May 17, 2018

I will! I had pinged @acdlite but he probably didn't see it, I'll be sure to sound the alarm more urgently next time 👍

@gaearon
Copy link
Collaborator

gaearon commented May 17, 2018

I mean on FB workplace :-) I don't think either of us check GH mentions, there's way too much noise and we can't keep up.

@ryerh
Copy link
Author

ryerh commented May 17, 2018

@aweary @gaearon I am feeling happy to be helpful.

Some other words: I think writing flow-oriented code in order to let flow-check pass makes me feel tricky. The typing system should work for safety, not for programming burden.

@gaearon
Copy link
Collaborator

gaearon commented May 17, 2018

It's a tradeoff. But writing this kind of code isn't just appeasing the type checker, it legitimately forces you to deal with potentially buggy code paths by making them safer or more explicit.

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

Successfully merging this pull request may close these issues.

None yet

4 participants