Skip to content

Commit

Permalink
fixed crash in resolve and typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaz Qadeer committed Jun 24, 2024
1 parent 6d3a6c3 commit 3bb2588
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Source/Concurrency/CivlUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public static int ResolveAndTypecheck(CoreOptions options, Absy absy)
}

var tc = new TypecheckingContext(null, options);
tc.CheckModifies = false; // to prevent access to tc.Proc which is null
absy.Typecheck(tc);
return tc.ErrorCount;
}
Expand All @@ -144,6 +145,7 @@ public static int ResolveAndTypecheck(CoreOptions options, Absy absy, Resolution
}

var tc = new TypecheckingContext(null, options);
tc.CheckModifies = false; // to prevent access to tc.Proc which is null
absy.Typecheck(tc);
return tc.ErrorCount;
}
Expand Down
16 changes: 8 additions & 8 deletions Source/Concurrency/InductiveSequentialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private Expr GetExitCondition(Action action)
return exitCondition == null ? Expr.False : Substituter.Apply(subst, exitCondition);
}

protected List<Declaration> GenerateExitPropertyAllPendingAsyncsNotInElimChecker(Action action)
protected List<Declaration> GenerateAllPendingAsyncsNotInElimChecker(Action action)
{
var eliminatedActionDecls = EliminatedActionDecls.ToHashSet();
var elimExprs = new List<Expr>();
Expand All @@ -675,12 +675,12 @@ protected List<Declaration> GenerateExitPropertyAllPendingAsyncsNotInElimChecker
GetCheck(action.tok, Expr.And(elimExprs), "Exit condition is true and there is a pending async to an eliminated action."),
};

// CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds);
return GetCheckerTuple($"{rule}_ExitProperty_AllPendingAsyncsNotInElim_{action.Name}", new List<Requires>(),
CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds);
return GetCheckerTuple($"{rule}_AllPendingAsyncsNotInElim_{action.Name}", new List<Requires>(),
action.Impl.InParams, action.Impl.OutParams, new List<Variable>(), cmds);
}

protected List<Declaration> GenerateExitPropertyAllPendingAsyncsInElimChecker(Action action)
protected List<Declaration> GenerateAllPendingAsyncsInElimChecker(Action action)
{
var eliminatedActionDecls = EliminatedActionDecls.ToHashSet();
var elimExprs = new List<Expr>();
Expand All @@ -704,8 +704,8 @@ protected List<Declaration> GenerateExitPropertyAllPendingAsyncsInElimChecker(Ac
GetCheck(action.tok, Expr.And(notElimExprs), "Exit condition is false and there is a pending async to an action not in eliminated actions."),
};

//CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds);
return GetCheckerTuple($"{rule}_ExitProperty_AllPendingAsyncsInElim_{action.Name}", new List<Requires>(),
CivlUtil.ResolveAndTypecheck(civlTypeChecker.Options, cmds);
return GetCheckerTuple($"{rule}_AllPendingAsyncsInElim_{action.Name}", new List<Requires>(),
action.Impl.InParams, action.Impl.OutParams, new List<Variable>(), cmds);
}

Expand Down Expand Up @@ -893,8 +893,8 @@ protected override List<Declaration> GenerateCheckers()
decls.AddRange(GenerateSideConditionChecker(targetAction));
foreach (var elim in eliminatedActions)
{
decls.AddRange(GenerateExitPropertyAllPendingAsyncsInElimChecker(elim));
decls.AddRange(GenerateExitPropertyAllPendingAsyncsNotInElimChecker(elim));
decls.AddRange(GenerateAllPendingAsyncsInElimChecker(elim));
decls.AddRange(GenerateAllPendingAsyncsNotInElimChecker(elim));
if (elim == targetAction)
{
continue;
Expand Down

0 comments on commit 3bb2588

Please sign in to comment.