It depends. It is based on the domain spam score and the backlink type.
If it is having more spam and did 301 redirection to your fresh domain, you will be penalized.
So try to remove the spam if it is having through disavow and do the 301 redirection.
If the domain was perfectly maintained and having less spam, you will be benefied on Google ranking.