-
Notifications
You must be signed in to change notification settings - Fork 62
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
SAW panic when using constraint guards with types dependent on module parameters #1923
Comments
In my testing it does seem to be happening in the constraint guard handling -- specifically in this call to The declaration that is causing the panic is this one, which has a , NonRecursive
( Decl
{ dName = Name
{ nUnique = 4780
, nInfo = GlobalName UserName
( OrigName
{ ogNamespace = NSValue
, ogModule = TopModule
( ModName "Instantiated" NormalName )
, ogSource = FromFunctorInst
, ogName = Ident False NormalName "x"
, ogFromParam = Nothing
}
)
, nFixity = Nothing
, nLoc = Range
{ from = Position
{ line = 8
, col = 1
}
, to = Position
{ line = 8
, col = 2
}
, source = "./Parameterized.cry"
}
}
, dSignature = Forall
{ sVars = []
, sProps = []
, sType = TCon ( TC TCSeq )
[ TCon
( TC
( TCNum 3 )
) []
, TCon ( TC TCBit ) []
]
}
, dDefinition = DExpr
( EPropGuards
[
( []
, EVar
( Name
{ nUnique = 4781
, nInfo = GlobalName UserName
( OrigName
{ ogNamespace = NSValue
, ogModule = TopModule
( ModName "Instantiated" NormalName )
, ogSource = FromFunctorInst
, ogName = Ident False NormalName "x()"
, ogFromParam = Nothing
}
)
, nFixity = Nothing
, nLoc = Range
{ from = Position
{ line = 8
, col = 1
}
, to = Position
{ line = 8
, col = 2
}
, source = "./Parameterized.cry"
}
}
)
)
]
( TCon ( TC TCSeq )
[ TVar
( TVBound
( TParam
{ tpUnique = 4782
, tpKind = KNum
, tpFlav = TPModParam
( Name
{ nUnique = 4782
, nInfo = GlobalName UserName
( OrigName
{ ogNamespace = NSType
, ogModule = TopModule
( ModName "Instantiated" NormalName )
, ogSource = FromFunctorInst
, ogName = Ident False NormalName "gamma1"
, ogFromParam = Just
( Ident False AnonIfaceModName "Parameterized" )
}
)
, nFixity = Nothing
, nLoc = Range
{ from = Position
{ line = 1
, col = 8
}
, to = Position
{ line = 1
, col = 21
}
, source = "./Parameterized.cry"
}
}
)
, tpInfo = TVarInfo
{ tvarSource = Range
{ from = Position
{ line = 1
, col = 8
}
, to = Position
{ line = 1
, col = 21
}
, source = "./Parameterized.cry"
}
, tvarDesc = TVFromModParam
( Name
{ nUnique = 4782
, nInfo = GlobalName UserName
( OrigName
{ ogNamespace = NSType
, ogModule = TopModule
( ModName "Instantiated" NormalName )
, ogSource = FromFunctorInst
, ogName = Ident False NormalName "gamma1"
, ogFromParam = Just
( Ident False AnonIfaceModName "Parameterized" )
}
)
, nFixity = Nothing
, nLoc = Range
{ from = Position
{ line = 1
, col = 8
}
, to = Position
{ line = 1
, col = 21
}
, source = "./Parameterized.cry"
}
}
)
}
}
)
)
, TCon ( TC TCBit ) []
]
)
)
, dPragmas = []
, dInfix = False
, dFixity = Nothing
, dDoc = Nothing
}
) |
Thanks, I was looking for |
Actually, I think this might be a Cryptol bug, because the |
I created GaloisInc/cryptol#1569 to track the Cryptol bug. The SAW import seems to work with the Cryptol fix applied. |
Great debugging! Thank you for looking into this! |
The Cryptol fix is merged now |
Thank you! I'll update the Cryptol submodule in SAW |
Closes #1923 This change updates the cryptol submodule to pull in the fix for constraint guards with types dependent on module parameters. See GaloisInc/cryptol#1569 for the relevant cryptol issue and GaloisInc/cryptol#1570 for the fix.
Closes #1923 This change updates the cryptol submodule to pull in the fix for constraint guards with types dependent on module parameters. See GaloisInc/cryptol#1569 for the relevant cryptol issue and GaloisInc/cryptol#1570 for the fix.
Given the parameterized module:
and instantiation:
and SAW file importing the instantiated module:
SAW panics with the error:
I'm still debugging exactly what's going on, but here are some things I learned in minimizing the example:
gamma1
in the environment fails (see this line of the translator), so I imagine some other part of the translator isn't addinggamma1
to the environment like it should.@qsctr I know you've been looking at the Cryptol translator lately and you have experience with the Cryptol AST. Do you have any ideas about what might be going wrong here?
I'm going to keep digging and I'll add comments for anything else I learn.
The text was updated successfully, but these errors were encountered: