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

Merge inferred return type like we do for params. Refs #359 #604

Merged
merged 1 commit into from
Nov 18, 2016

Conversation

tmcw
Copy link
Member

@tmcw tmcw commented Nov 18, 2016

No description provided.

@tmcw tmcw merged commit 29cd58b into master Nov 18, 2016
@tmcw tmcw deleted the merge-infered-return-type-359 branch November 18, 2016 16:59
type: flowDoctrine(fn.returnType.typeAnnotation)
}];
var returnType = flowDoctrine(fn.returnType.typeAnnotation);
if (comment.returns) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to check that returns is an array of at least one element here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

We won't get to this point if it isn't, since we return early on L20 if comment.returns.length is 0.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't see it. The early return happens if it is a non empty array with a type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, good point. I'm not sure that that returns: [] ever happens in practice, but I'll add a guard here just to be sure.

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