- Nothing -> return (pcs0, []);
- Just rdr_name -> do
-
- -- if the identifier is a constructor (begins with an
- -- upper-case letter), then we need to consider both
- -- constructor and type class identifiers.
- let rdr_names
- | occNameSpace occ == dataName = [ rdr_name, tccls_name ]
- | otherwise = [ rdr_name ]
- where
- occ = rdrNameOcc rdr_name
- tccls_occ = setOccNameSpace occ tcClsName
- tccls_name = setRdrNameOcc rdr_name tccls_occ
-
- (pcs, unqual, maybe_rn_result) <-
- renameRdrName dflags hit hst pcs0 iNTERACTIVE icontext rdr_names
-
- case maybe_rn_result of {
- Nothing -> return (pcs, []);
- Just (names, decls) -> do {
-
- maybe_pcs <- typecheckExtraDecls dflags pcs hst unqual
- iNTERACTIVE decls;
-
- case maybe_pcs of {
- Nothing -> return (pcs, []);
- Just pcs ->
- let maybe_ty_things = map (lookupType hst (pcs_PTE pcs)) names
- in
- return (pcs, catMaybes maybe_ty_things) }
- }}}
-
-myParseIdentifier dflags str
- = do buf <- stringToStringBuffer str
-
- let glaexts | dopt Opt_GlasgowExts dflags = 1#
- | otherwise = 0#
-
- case parseIdentifier buf
- PState{ bol = 0#, atbol = 1#,
- context = [], glasgow_exts = glaexts,
- loc = mkSrcLoc SLIT("<interactive>") 1 } of
-
- PFailed err -> do { hPutStrLn stderr (showSDoc err);
- freeStringBuffer buf;
- return Nothing }
-
- POk _ rdr_name -> do { --should, but can't: freeStringBuffer buf;
- return (Just rdr_name) }
+ Nothing -> return [];
+ Just (L _ rdr_name) -> do
+
+ maybe_tc_result <- tcRnGetInfo hsc_env ic rdr_name
+
+ let -- str' is the the naked occurrence name
+ -- after stripping off qualification and parens (+)
+ str' = occNameUserString (rdrNameOcc rdr_name)
+
+ case maybe_tc_result of {
+ Nothing -> return [] ;
+ Just things -> return [(str', t) | t <- things]
+ }}