Would a polymorphed undead retain any diseases when it reverts back to normal form

Specifically, if I cast a heightened polymorph a lich, turning it into a sheep or caterpillar or something then cast contagion on it (5th level cleric spell that gives the target a disease of the casters choosing after it fails 3 CON saves) then revert it back to lich via damage, would it still carry the disease?

Can a Polymorphed creature still command a Dancing Sword?

If a creature has been Polymorphed into a beast, can it still use an already summoned Dancing Sword to attack?

Polymorph says:

The target’s game statistics, including mental ability scores, are replaced by the statistics of the chosen beast. It retains its alignment and personality.

The creature is limited in the actions it can perform by the nature of its new form, and it can’t speak, cast spells, or take any other action that requires hands or speech.

The target’s gear melds into the new form. The creature can’t activate, use, wield, or otherwise benefit from any of its equipment.

Dancing Sword says:

While the sword hovers, you can use a bonus action to cause it to fly up to 30 feet to another spot within 30 feet of you. As part of the same bonus action, you can cause the sword to attack one creature within 5 feet of it.

If you have cast Spiritual Weapon and then you are polymorphed, can you make melee spell attacks?

I have a player that would like to cast Polymorph on the party’s cleric.

If the cleric has already cast Spiritual Weapon on himself (this is not a concentration spell) and he is Polymorphed into say a Giant Ape, does he still have the ability to make Melee spell attacks as a bonus action?

I know that you can continue to concentrate on spells that you cast before you Polymorph, and that you cannot cast new spells. But would a great ape be able to make a “melee spell attack”?

Does Locate Object work on polymorphed equipment?

The spell Locate Object says:

You sense the direction to the object’s location, as long as that object is within 1,000 feet of you.

The spell Polymorph says:

The target’s gear melds into the new form. The creature can’t activate, use, wield, or otherwise benefit from any of its equipment.

If the object targeted by Locate Object has been "melded into the new form" of a polymorphed person will Locate Object succeed?

On one hand you could say the item, eg a spear, temporarily doesn’t exist and so cannot be located.

On the other hand spells only do what they say they do and Polymorph does not say is hides items from being detected.

Does contingency work if you are polymorphed and so the statuette merged with your body?

The spell Contingency has a material component of:

a statuette of yourself carved from ivory and decorated with gems worth at least 1,500 gp

The spell also ends if this statue isn’t on your person.

Also, contingency ends on you if its material component is ever not on your person.

If you are polymorphed into another form, the spell Polymorph states:

The target’s gear melds into the new form. The creature can’t activate, use, wield, or otherwise benefit from any of its equipment.

Is having the contingency spell not end a "benefit" of your equipment? Or, since it’s melded into your form, is it still on your person? Would the contingency still trigger after reverting to your humanoid form?

How does resistance/vulnerability/immunity interact with carryover damage after reducing a Polymorphed (or Wild Shaped) form to 0 HP?

A caster casts polymorph on another creature. Let’s say the polymorphed creature has 10 HP in its new form, but takes 30 piercing damage and its current form is reduced to 0 HP. This causes it to revert back to its original form, with 20 more piercing damage that would carry over. However, its original form is resistant to piercing damage.

How much damage would the new form actually take? Would its original form’s resistance to the damage type apply to the carryover damage?

The same question can be extended to the original form having immunity or vulnerability, as the answer would ostensibly use the same logic.

The druid’s Wild Shape ability also works similarly to polymorph in this regard (if you reduce the new form to 0 HP, then any remaining damage carries over to its original form), so I suspect the answer would be similar for a similar question about Wild Shape.

Do true polymorphed gold dragons retain their ability to cast spells?

I recently rewatched Mr. Rhexx’s video on gold dragons and he mentioned that they love to practice magic. He also mentioned that all dragons can innately cast spells but gold dragons choose to further their magic prowess. Now true polymorph states that whilst morphed you can’t cast spells unless your new form is capable of such. Now spell casting actually isn’t present in the 5e gold dragon stat block so my question is if a mage was true polymorphed into a gold dragon would they still be able to cast spells?

What happens when a creature that has swallowed another creature is polymorphed?

Twice this week, I have faced a situation where Polymorph was going to be cast on a creature that had swallowed a PC. As a DM, I ruled that if the polymorphed form was smaller, the swallowed PC would burst out, causing damage to the creature. As a player, my DM ruled that the spell would simply fail.

Are there any rules on what should happen in this scenario? The texts of Polymorph and the swallow ability of various monsters don’t seem to address this situation.

(Related, but for 4e, and Related, but in the other direction)