Test and refactor TreeInfo#defPath

Review by @odersky