-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--check
causes <<loop>>
for basic expressions
#1016
Comments
Thanks for the report. The initial hunch is that I kind of went wild along here & swapped cons into snocs in some places, which looking back probably shouldn't, but I had some ideas to find optimizations in mind, thou not finished that. Those changes may cause infinite loops. But also there are many other things that may cause it. A bunch of reports need bisecting. Thankfully commits are good for that & https://github.com/Anton-Latukha/git-bisect-master-pr. Would look into it when would make a release from The code that processes the Lines 119 to 128 in d3d4356
|
Thank you @Anton-Latukha, I will look into it |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Currently seems it was "always" present. (at least, an old bug). It is present in Currently waiting for when Hackage would update with the new snapshot. |
Well, it goes beyond |
Before |
It is pre Before, |
Syndrome is: Works great:
Referencing set - nope:
|
@Anton-Latukha thank you for looking into this. I did a bit of debugging. The The following diff against 4321e7d diff --git a/main/Main.hs b/main/Main.hs
index 378fa468..00f487bd 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -32,6 +32,7 @@ import Prettyprinter hiding ( list )
import Prettyprinter.Render.Text ( renderIO )
import qualified Repl
import Nix.Eval
+import qualified Debug.Trace
main :: IO ()
main =
@@ -124,7 +125,7 @@ main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl
(liftIO . putStrLn . (<>) "Type of expression: " .
ppShow . maybeToMonoid . Map.lookup @VarName @[Scheme] "it" . coerce
)
- $ HM.inferTop mempty $ curry one "it" $ stripAnnotation expr'
+ $ HM.inferTop mempty $ (\expr'' -> ("inferTop: " <> show expr) `Debug.Trace.trace` expr'') $ curry one "it" $ stripAnnotation expr'
-- liftIO $ putStrLn $ runST $
-- runLintM opts . renderSymbolic =<< lint opts expr
diff --git a/src/Nix/Scope.hs b/src/Nix/Scope.hs
index d9de14a3..70248725 100644
--- a/src/Nix/Scope.hs
+++ b/src/Nix/Scope.hs
@@ -10,6 +10,7 @@ import qualified Data.HashMap.Lazy as M
import qualified Text.Show
import Lens.Family2
import Nix.Expr.Types
+import qualified Debug.Trace
-- 2021-07-19: NOTE: Scopes can gain from sequentiality, HashMap (aka AttrSet) may not be proper to it.
newtype Scope a = Scope (AttrSet a)
@@ -110,6 +111,11 @@ lookupVarReader
-> m (Maybe a)
lookupVarReader k =
do
+ Debug.Trace.traceM $ "lookupVarReader: " <> show k
+ lexicalScopes' <- asks $ lexicalScopes @m . view hasLens
+ Debug.Trace.traceM $ "lexicalScopes length: " <> show (length lexicalScopes')
+ Debug.Trace.traceM $ "lexicalScopes: " <> show (lexicalScopes' :: [Scope a])
+
mres <- asks $ scopeLookup k . lexicalScopes @m . view hasLens
maybe will produce this output:
So first a pass runs prior to |
Looked into the So far not found the cause, but the process definitely approaches closer. If to use only the dynamic scope search - the process terminates: cabal run hnix -- --check --expr '
let {
x = "foo";
y = "bar";
body = x + y;
}
'
...
Type of expression: [ Forall [ TV "a" ] (TVar (TV "a")) ]
rec {
x = "foo";
y = "bar";
body = x + y;
}.body Soon would ship the simplified version of the code & it would be easier to look further. |
I get a
<<loop>>
when trying to evaluate many simple Nix expressions using--check
, e.g. data/nix/tests/lang/eval-okay-let.nix:This applies to all of the following expressions:
Is
--check
supposed to work?I'm on
master
, building hnix usingnix-build
using the "Full debug info" options on macOS.The text was updated successfully, but these errors were encountered: