I have encountered the following sentence in the wild and it strikes me as incorrect. Is my logic sound?
Thanks to whomever left this.
First, I reconstructed the sentence with whomever as the direct object.
Thanks to whomever.
This seems perfectly good because whomever is a direct object pronoun. Now, we return to my proposed correction of the original sentence:
Thanks to whoever left this.
In my view, we have an implied subject and an implied object, so we could parse the sentence as follows:
[I give] thanks to whoever left this [thing].
In this sense, the implied subject I corresponds to the indirect object whoever, while whoever itself corresponds to the implied object thing (while this acts as an adjective). Does this make sense?