-
Notifications
You must be signed in to change notification settings - Fork 205
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
WIP: Draft version constraint generation #5472
Changes from 1 commit
040ef56
0205507
3476a5e
4675fdd
afc3766
c329b37
f3e4d17
a7ef445
c99827d
28eb1bb
80bb27a
220d21d
2bad89e
733f929
5545943
b736d85
4bc25cb
310d7b0
4b08356
e04944f
18b0b97
2f3bf70
0911a90
6651d8d
a8e6c94
50c56c3
d880fa5
aef855a
6c86c22
1c21ff2
a33365c
64370c2
f3bee74
13eb8a4
16aa3e3
642c1b9
c791f31
ba1fad5
344eca8
1cdf6e4
cdbed09
c62c276
ed91ada
b803eb9
a3ee542
91c989c
337b0ca
49563b0
ae4a276
77ea060
2d7c840
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,35 @@ import Options.Applicative | |
import DA.Daml.LF.Ast | ||
|
||
data Options = Options | ||
{ optInputDars :: [FilePath] | ||
{ optInputDar :: FilePath | ||
, optChoiceTmpl :: String | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be easier to understand if you already use the proper LF type here. |
||
, optChoiceName :: String | ||
, optFieldTmpl :: String | ||
, optFieldName :: String | ||
} | ||
|
||
optionsParser :: Parser Options | ||
optionsParser = Options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having so many positional arguments will probably become an issue in the future because it's easy to mix them up. But let's fix that in a follow-up PR. |
||
<$> some ( argument str | ||
( metavar "DAR-FILES" | ||
<> help "DAR files to analyse" | ||
) ) | ||
<$> argument str | ||
( metavar "DAR-FILE" | ||
<> help "DAR file to analyse" | ||
) | ||
<*> argument str | ||
( metavar "CHOICE-TEMPLATE" | ||
<> help "Template of the choice to analyse" | ||
) | ||
<*> argument str | ||
( metavar "CHOICE-NAME" | ||
<> help "Name of the choice to analyse" | ||
) | ||
<*> argument str | ||
( metavar "FIELD-TEMPLATE" | ||
<> help "Template of the field to verify" | ||
) | ||
<*> argument str | ||
( metavar "FIELD-NAME" | ||
<> help "Name of the field to verify" | ||
) | ||
|
||
optionsParserInfo :: ParserInfo Options | ||
optionsParserInfo = info (optionsParser <**> helper) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,19 +168,21 @@ filterCondUpd tem f (Conditional b x (Just y)) = | |
constructConstr :: Env 'Solving | ||
-- ^ The generator environment to convert. | ||
-> TypeConName | ||
-- ^ The template name to be verified. | ||
-- ^ The template name of the choice to be verified. | ||
-> ChoiceName | ||
-- ^ The choice name to be verified. | ||
-> TypeConName | ||
-- ^ The template name of the field to be verified. | ||
-> FieldName | ||
-- ^ The field name to be verified. | ||
-> ConstraintSet | ||
constructConstr env tem ch f = | ||
case lookupChoInHMap (_envschs env) tem ch of | ||
constructConstr env chtem ch ftem f = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we come up with slightly clearer variable names, e.g. |
||
case lookupChoInHMap (_envschs env) chtem ch of | ||
Just (self, this, arg, updSubst) -> | ||
Gertjan423 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let upds = _ussUpdate $ updSubst (EVar self) (EVar this) (EVar arg) | ||
vars = concatMap skol2var (_envsskol env) | ||
(cres, arcs) = foldl | ||
(\(cs,as) upd -> let (cs',as') = filterCondUpd tem f upd in (cs ++ cs',as ++ as')) | ||
(\(cs,as) upd -> let (cs',as') = filterCondUpd ftem f upd in (cs ++ cs',as ++ as')) | ||
([],[]) upds | ||
in ConstraintSet vars cres arcs | ||
Nothing -> error "Choice not found" | ||
Gertjan423 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this only works in our Bazel setup. We need to figure out what we do if we ship things to users. Not sure if we want to ship an SMT solver so a reasonable option might be to let users pass a path to the SMT solver they want to use.