zephir
zephir copied to clipboard
Failure to call overloaded method when compiled with `internal-call-transformation: true`
Greetings Phalcon/Zephir team,
The multiply, divide, add, subtract, greater, greater equal, less, and less equal tests starting here fail when the Tensor extension is compiled with "internal-call-transformation: true". They do not fail when the extension is compiled without the optimization.
It looks like what's happening is that the non-static child methods on ColumnVector that overload the parent's (Vector) methods are not being called. Instead the parent method is being called with the same method signature. This explains why the result is erroneous for multiplication, addition, etc. with a column vector (i.e. test fail) but is correct for a row vector.
@dreamsxin Could you take a look by any chance?
I will test it tomorrow
@sergeyklay
Vector.zep
protected function multiplyMatrix(const <Matrix> b) -> <Matrix>
{
//...
}
public function multiply(const var b)
{
return this->multiplyVector(b);
}
ColumnVector.zep
class ColumnVector extends Vector {
protected function multiplyMatrix(const <Matrix> b) -> <Matrix>
{
}
}
In vector.zep.c the internal function name is fixed, can't overload.
ZEPHIR_RETURN_CALL_INTERNAL_METHOD_P1(this_ptr, zep_Tensor_Vector_multiplyMatrix_zephir_internal_call, b);
Zephir should stipulate that no inherited method can automatically become an internal function
@andrewdalpino Hello, is this still and bug or it was fixed?
@andrewdalpino Hello, is this still and bug or it was fixed?
Hey @Jeckerson, I can't remember hahah but it hasn't effected our development lately. I will say we no longer have an "internal-call-transformation: true" entry in our config.json. I do remember having to turn this optimization off specifically with previous versions.