If you upgrade a skill while casting you’ll do more damage (if the ability has any), less cooldwon to the next activation, and you’ll have paid only the energy required by the previous level of the ability.
Let’s say you are using Gwen’A
At level 1, this ability gives (as of patch 4.11):
Energy Cost: 50
Slow Strength 0%
At level 2:
Energy Cost: 55
Slow Strength: 0%
By upgrading this ability at level 2 right after you activated it, you’ll use the upgraded stats (105 damage, 6.5s cooldown) but you’ll only have paid the 50 energy required for the ability at level 1.
Why? Because you pay the energy at the moment you cast the skill, but your damage is checked when you actually hit the target (beside upgrading skill, this also mean that if you buy items you’ll receive the benefits even for skills you already used that have not yet hit their target. By example you can throw a Celeste’s C to someone in the other side of the map, successively buy a shatterglass and your C will do more damage!
This is also true for things such as a previously placed Ylva’s trap, which will do more damage if you buy extra CP after the placement.)
What about skills with special effects on overdrive?
It depends on how they work. By example, San Feng’s immunity to negative status on A and B overdrive starts from the moment the skill is casted. So if a Ringo’s C is coming to you, you trigger B and upgrade the skill during cast, you will not be immune to the burn effect.
However, Fortress’ B slow on overdrive is checked when you actually perform the 6 basic attacks required. So you can trigger the ability, perform 5 basic attacks, upgrade the ability to level 5, perform the last basic attack and you’ll get the slow.
This is also true for dot damage, such as the burn from Adagio’s A. You’ll do more damage by upgrading the ability or buying items after have placed the burn on someone.