He (Ibn Hazm Al-Andalusi) says,
...
Brief translation:
God guaranteed for the people of monotheism to accept [their repentance] before they gargle, last moment before death, explained the Prophet (PBUH). Then He excluded in the other verse, 8:38, by saying "Except what was before (pre-Islam)" so it became abrogating to a part of its ruling.
Dr. Mustafa Zayd, in his book النسخ في القرآن الكريم, volume 1, pages 421-422 (items 592-593), noticed that no scholar who agreed about this claim has quoted a narration to support the claim! Indeed, most claims of abrogation have been initiated by a narration tracing back to a Sahaabi, usually Ibn Abbaas. Dr. Zayd wonders why no scholar have noticed a narration by Ibn Abbaas, reported by At-Tabari, which implies that 4:18 is the one that was abrogated! By 4:17. That is, for disbelievers, repentance at the moment of death is unacceptable, but for the believers, it may be.
Dr. Zayd also makes an excellent observation in the footnotes. He noticed the phrase
على الله (Upon God) in 4:17, but no similar phrase in 4:18. Thus, he concludes that 4:17 cannot possibly be abrogated, since it something that God mandated on Himself!
Dr. Zayd also says that 4:17 specifies the conditions for acceptance of repentance, while 4:18 specifies the conditions for rejection of repentance. I'd add that the two sets do not intersect. If they did, there would be a legitimate cause to consider abrogation.
Dr. Zayd makes another excellent refutation argument. He says that 4:18 started with those, believers or otherwise, who continue to sin until they see the angel of death and decide to repent then. Their repentance is unaccepted. The subsequent group, disbelievers who die as such, are, by analogy, in the category of "all the more reason" (من باب أولى).