on master help sign in
Name resolution should respect %hide

Fixes #573

commit6b3457aa85262476c85aa84b5cc48eaa85373a46 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateSun 3 Nov 2013, 11:06 (13 years ago) parent1668f2b
3 files changed+18−4
Makefile+4−2 src/Core/Evaluate.hs+1−1 src/Idris/AbsSyntax.hs+13−1
Makefile+4−2
@@ -1,4 +1,4 @@
1−.PHONY: build configure doc install linecount nodefault pinstall relib test
1+.PHONY: build configure doc install linecount nodefault pinstall lib_clean relib test
22
33include config.mk
44-include custom.mk
@@ -22,10 +22,12 @@ test_java:
2222test_llvm:
2323 $(MAKE) -C test IDRIS=../dist/build/idris test_llvm
2424
25−relib:
25+lib_clean:
2626 $(MAKE) -C lib IDRIS=../dist/build/idris/idris RTS=../dist/build/rts/libidris_rts clean
2727 $(MAKE) -C effects IDRIS=../dist/build/idris/idris RTS=../dist/build/rts/libidris_rts DIST=../dist/build clean
2828 $(MAKE) -C javascript IDRIS=../dist/build/idris/idris RTS=../dist/build/rts/libidris_rts DIST=../dist/build clean
29+
30+relib: lib_clean
2931 $(CABAL) install $(CABALFLAGS)
3032
3133linecount:
src/Core/Evaluate.hs+1−1
@@ -8,7 +8,7 @@ module Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
88 Context, initContext, ctxtAlist, uconstraints, next_tvar,
99 addToCtxt, setAccess, setTotal, addCtxtDef, addTyDecl,
1010 addDatatype, addCasedef, simplifyCasedef, addOperator,
11− lookupNames, lookupTy, lookupP, lookupDef, lookupVal,
11+ lookupNames, lookupTy, lookupP, lookupDef, lookupDefAcc, lookupVal,
1212 lookupTotal, lookupTyEnv, isDConName, isTConName, isConName, isFnName,
1313 Value(..), Quote(..), initEval) where
1414
src/Idris/AbsSyntax.hs+13−1
@@ -1180,7 +1180,9 @@ aiFn inpat expat ist fc f as
11801180 | f `elem` primNames = Right $ PApp fc (PRef fc f) as
11811181aiFn inpat expat ist fc f as
11821182 -- This is where namespaces get resolved by adding PAlternative
1183− = case lookupCtxtName f (idris_implicits ist) of
1183+ = do let ns = lookupCtxtName f (idris_implicits ist)
1184+ let ns' = filter (\(n, _) -> notHidden n) ns
1185+ case ns' of
11841186 [(f',ns)] -> Right $ mkPApp fc (length ns) (PRef fc f') (insertImpl ns as)
11851187 [] -> if f `elem` (map fst (idris_metavars ist))
11861188 then Right $ PApp fc (PRef fc f) as
@@ -1190,6 +1192,16 @@ aiFn inpat expat ist fc f as
11901192 map (\(f', ns) -> mkPApp fc (length ns) (PRef fc f')
11911193 (insertImpl ns as)) alts
11921194 where
1195+ notHidden n = case getAccessibility n of
1196+ Hidden -> False
1197+ _ -> True
1198+
1199+ getAccessibility n
1200+ = case lookupDefAcc n False (tt_ctxt ist) of
1201+ [(n,t)] -> t
1202+ _ -> Public
1203+
1204+
11931205 insertImpl :: [PArg] -> [PArg] -> [PArg]
11941206 insertImpl (PExp p l ty _ : ps) (PExp _ _ tm d : given) =
11951207 PExp p l tm d : insertImpl ps given