Fix variable elaboration
Fix variable elaboration

Variable elaboration is a bit tricky because of unbound implicits and
types and needing to bind pattern variables.

This lifts out the elaborator for references to *defined* variables
(i.e. once we know it's not a pattern variable/implicit) into a common
place. As a result, it fixes an issue with scoped implicits where they
weren't being applied properly, and allows us to remove a hack (which I
didn't properly understand but as a result of this fix, I do now...)
Fixes #3683

uuhan/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,Heather/Idris-dev,mpkh/Idris-dev,uuhan/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,FranklinChen/Idris-dev,markuspf/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,FranklinChen/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,Heather/Idris-dev,markuspf/Idris-dev,mpkh/Idris-dev,mpkh/Idris-dev,Heather/Idris-dev,FranklinChen/Idris-dev,kojiromike/Idris-dev,Heather/Idris-dev,FranklinChen/Idris-dev,FranklinChen/Idris-dev,kojiromike/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,FranklinChen/Idris-dev,kojiromike/Idris-dev,Heather/Idris-dev,mpkh/Idris-dev,uuhan/Idris-dev,mpkh/Idris-dev,Heather/Idris-dev,uuhan/Idris-dev,kojiromike/Idris-dev,mpkh/Idris-dev