🌐 AI搜索 & 代理 主页
Skip to content

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.

3 participants