I'd always thought it went something like this: Finally if you're carrying an upgraded weapon, drop it, pick up a different copy, and then pick up the original- the game gives you whichever version of the weapon had the most upgrades while the other disappears. one sitting on the ground) then you receive the ammo and the weapon disappears.
If you drop your weapon before looting a new one, then you can pick up the new one. If you have the weapon and your ammo is already full, you pick up nothing and both the weapon and ammo disappear from the corpse. If you're already carrying a copy of a weapon and you try to loot the same weapon from an enemy corpse, you only pick up the ammo, and only as much as you have room for (while the rest disappears).