(1) A prior testamentary disposition by the testator is cancelled by a contract of inheritance to the extent that it would adversely affect the right of a person provided for under the contract. A later disposition mortis causa is, notwithstanding the provision of section 2297, ineffective to the same extent.
(2) If the person provided for is a descendant of the testator who is entitled to a compulsory share, the testator may, by a later testamentary disposition, give the directions permitted by section 2338.