-tcInferRho :: RenamedHsExpr -> TcM (TcExpr, TcRhoType)
-tcInferRho (HsVar name) = tcId name
-tcInferRho expr = newHole `thenM` \ hole ->
- tcMonoExpr expr (Infer hole) `thenM` \ expr' ->
- readMutVar hole `thenM` \ rho_ty ->
- returnM (expr', rho_ty)
+tcInferRho :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
+tcInferRho (L loc (HsVar name)) = addSrcSpan loc $
+ do { (e,ty) <- tcId name; return (L loc e, ty)}
+tcInferRho expr = newHole `thenM` \ hole ->
+ tcMonoExpr expr (Infer hole) `thenM` \ expr' ->
+ readMutVar hole `thenM` \ rho_ty ->
+ returnM (expr', rho_ty)