Tgr added a comment.
The diff logic leaves it to the SlotDiffRenderer implementation to handle incompatible types. Sorry about that, it's a bit shoddy. I don't remember if there was some specific reason for not turning it into a user error, or it was merely rushed. From a distance, the simple solution would be to create a UserPageError subclass describing the situation and throw that instead of the assertion error. All SlotDiffRenderer subclasses would still have to implement the check but with a helper method that's just a one-liner and we don't want to preclude a differ's ability to provide special handling for different content types (even if there's another wart there, that depending on which content is on the left and which on the right side, you'll probably end up calling a different slot diff renderer implementation). TextSlotDiffRenderer can compare any two TextContent subclasses. I don't think there's a real example today of a SlotDiffRenderer doing anything with a "foreign" content type, but there are use cases where it seems reasonable, especially when the page can be converted between the various types (e.g. wikitext <-> Flow <-> LiquidThreads). TASK DETAIL https://phabricator.wikimedia.org/T231084 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Tgr Cc: Ladsgroup, Tgr, Michael, Lucas_Werkmeister_WMDE, Aklapper, zeljkofilipin, darthmon_wmde, DannyS712, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Wikidata-bugs, aude, Jdforrester-WMF, Mbch331, Jay8g, Krenair
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
