Hello Mojang,
I got an Impaling IV and Unbreaking III Trident from an Enchantment Table. I have an Enchanted Book with Riptide III and Sharpness III and another one with Riptide III only. Combining the Trident with the first book on an anvil costs 7 levels, but combining it with the second only costs 6 levels. From my understanding, Sharpness III is inapplicable to Tridents and thus should be ignored. Therefore, I believe this is a bug.
Steps to reproduce:
/gamemode survival
/give @p minecraft:trident[enchantments={impaling:4,unbreaking:3}]
/give @p minecraft:enchanted_book[stored_enchantments={riptide:3,sharpness:3}]
/give @p minecraft:enchanted_book[stored_enchantments={riptide:3}]
/give @p minecraft:anvil
Try combining the Trident with each of the two books
Please let me know if you need anything else from me. Thank you!
Regards,
Leo Li
Reproduced with other items/enchants in 26.1-snapshot-5