Fix source locations and reporting of duplicate defs.