Gregory Peck said that every romantic comedy script he ever got sent had the fingerprints of Cary Grant on it. The producers had tried for Grant first, and when he turned them down had gone for the next actor down the food chain. This happened for example on "Roman Holiday
", which won an academy award for best writing, though not necessarily for best re-writing for recast lead.
Another classic example is "The Ladykillers
", which was originally written for Alastair Sim, but finally made with Alec Guinness. He played the part almost as an impression of Alastair Sim, so much so that Sim's daughter said that many people thought her father had played the part.
It's obviously not necessary that the fingerprints of the star are literally on the script! But ideally the star should have really turned down the script, and the film as made should not have made any major adjustments to the recasting.