From 4c243b28a17478f6d810668667642fff55126f87 Mon Sep 17 00:00:00 2001 From: Lukasz Czajka Date: Fri, 6 Dec 2024 19:03:37 +0100 Subject: [PATCH] fix scoping --- .../Translation/FromParsed/Analysis/Scoping.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs index 8f0b7b2b57..75c3f8f144 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs @@ -745,15 +745,13 @@ lookupSymbolAux modules final = do path1 = topPath ^. modulePathDir ++ [topPath ^. modulePathName] path2 = path0 ^. S.absLocalPath pref = commonPrefix path2 modules - if - | isPrefixOf path1 modules -> do - let modules' = drop (length path1) modules - pref' = commonPrefix path2 modules' - lookPrefix pref' path2 modules' - | not (null pref) -> - lookPrefix pref path2 modules - | otherwise -> - lookupLocalSymbolAux (const True) modules final + when (isPrefixOf path1 modules) $ do + let modules' = drop (length path1) modules + pref' = commonPrefix path2 modules' + lookPrefix pref' path2 modules' + when (not (null pref)) $ + lookPrefix pref path2 modules + lookupLocalSymbolAux (const True) modules final lookPrefix :: [Symbol] -> [Symbol] -> [Symbol] -> Sem r () lookPrefix pref path modules' = do