haskell-suite / haskell-names

Haskell suite library for name resolution
52 stars 17 forks source link

In tests/annotations/FnBind.hs, shouldn't f be global? #71

Closed ddssff closed 8 years ago

ddssff commented 8 years ago

If there is no export list I would expect everything top level to be global, but...

% ghci
> :m +Language.Haskell.Exts.Annotated Language.Haskell.Names Data.Generics Control.Monad
> let parsemod s = let ParseOk m = parseModule s in let env = resolve [m] mempty in annotate env m
> let gfind = (msum . map return . listify (const True))
> let has ss x = (not . null . filter (`elem` ss)) (gfind x :: [String])
> let test s = mapM_ (putStrLn . show) $ filter (has ["f"]) $ (gfind (parsemod s) :: [NameInfo SrcSpanInfo])
> test "module M (f) where\nf x = x + 1\n"
Export [Value {symbolModule = ModuleName "M", symbolName = Ident "f"}]
GlobalSymbol (Value {symbolModule = ModuleName "M", symbolName = Ident "f"}) (UnQual (Ident "f"))
GlobalSymbol (Value {symbolModule = ModuleName "M", symbolName = Ident "f"}) (UnQual (Ident "f"))
> test "module M where\nf x = x + 1\n"
>
ddssff commented 8 years ago

Found ModuleSymbols.hs