Pronoun placement in compound tenses

In Portuguese, compound tenses are formed using the auxiliary verb ter (to have) followed by a past participle, such as tinha dado (had given) or tenho testado (have been testing).

Attaching Pronouns to the Auxiliary

When replacing a direct or indirect object with a pronoun in a compound tense, the pronoun attaches directly to the conjugated auxiliary verb with a hyphen. It never attaches to the past participle.

I had given the new version to the creator. I had shown him the prototype.
Eu tinha dado a nova versão ao criador. Tinha-lhe mostrado o protótipo.

Spelling Adjustments: -no and -na

Remember that when a verb form ends in -m (like tinham, tem, or têm), the direct object pronouns o, a, os, and as change to -no, -na, -nos, and -nas. This rule applies perfectly to the auxiliary verb ter in compound tenses.

The mechanic was complicated, therefore they had simplified it.
A mecânica era complicada, portanto eles tinham-na simplificado.
The prototype is addictive. They have been playing it every day.
O protótipo é viciante. Eles têm-no jogado todos os dias.

Magnet Words Pull Pronouns Forward

Just like in simple tenses, certain words act as "magnets" and pull the pronoun before the conjugated verb. If the clause contains a negative word (like não or nem) or a relative pronoun (like quem), the pronoun goes immediately before the auxiliary verb ter.

The scoring happens in the last round. The player had not understood it.
A pontuação acontece na última ronda. O jogador não a tinha compreendido.
I have a new game. The creator to whom I had given it lost it.
Tenho um jogo novo. O criador a quem o tinha dado perdeu-o.