tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
394 stars 111 forks source link

Overriding non-existing function doesn't throws an error #1022

Open imartemy1524 opened 1 week ago

imartemy1524 commented 1 week ago

Are you using the latest released (or pre-released, a.k.a. "next") version?

Tact source code

contract Test with Deployable {
    receive("test"){
        self.notDefined();
    }
    // don't thow any error and compile successfully, BUT, this function is not defined anywhere else
    override fun notDefined(){
        self.reply("OK".asComment());
    }
}

Relevant Tact/build system log output

Compiled successfully

What happened?

One tries to override non-existing function and compiler allows one to do it. This can lead to errors in case of typos:

trait Testt{
    virtual fun doThings(){}
    receive("ok"){self.doThings();}
}
contract ContractWithTypo with Deployable, Testt {

    override fun doTThings(){
        self.reply("OK".asComment());
    }
}

One may not recognize the typo, and compiler doesn't warn him about it, which leads to unpredictable behaviour.

What did you expect?

That compiler throws an error

Steps to reproduce

No response

How do you run Tact?

Blueprint

Anything else?

No response