Skip to content

Commit

Permalink
[Nemo] Dont report UseVoidReturn errors for possibly-overridden methods
Browse files Browse the repository at this point in the history
Summary: When WholeProgram is false, any non-private method could be overridden
by an unseen class. So dont report UseVoidReturn errors.

Test Plan: fast_tests slow_tests. Manually verify a test case which incorrectly
reported UseVoidReturn with default settings.

Reviewers: myang, qigao

Reviewed By: myang

CC: ps, mwilliams, myang, michalburger1

Differential Revision: 323294
  • Loading branch information
mwilliams authored and macvicar committed Sep 23, 2011
1 parent 3c210d9 commit e53cc8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compiler/expression/function_call.cpp
Expand Up @@ -547,7 +547,10 @@ TypePtr FunctionCall::checkParamsAndReturn(AnalysisResultPtr ar,
if (!isUnused() && !type->is(Type::KindOfAny)) {
if (!hasContext(ReturnContext) &&
!func->isFirstPass() && !func->isAbstract()) {
Compiler::Error(Compiler::UseVoidReturn, self);
if (Option::WholeProgram || !func->getContainingClass() ||
func->isStatic() || func->isFinal() || func->isPrivate()) {
Compiler::Error(Compiler::UseVoidReturn, self);
}
}
m_voidWrapper = true;
}
Expand Down

0 comments on commit e53cc8c

Please sign in to comment.