Skip to content

Commit

Permalink
Further cleanup in datatype translation (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
shazqadeer authored Oct 25, 2024
1 parent 934a194 commit 4881964
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 0 additions & 4 deletions Source/Core/AST/Absy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,6 @@ public override string ToString()
{
return cce.NonNull(Name);
}

public virtual bool MayRename => true;
}

public class TypeCtorDecl : NamedDeclaration
Expand Down Expand Up @@ -1971,8 +1969,6 @@ public DatatypeConstructor(Function func)
: base(func.tok, func.Name, func.TypeParameters, func.InParams, func.OutParams[0], func.Comment, func.Attributes)
{
}

public override bool MayRename => false;
}

public class Function : DeclWithFormals
Expand Down
6 changes: 1 addition & 5 deletions Source/VCExpr/ScopedNamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ public virtual string GetName(object thing, string inherentName)
}

var uniqueInherentName = NextFreeName(thing, inherentName);
if (thing is NamedDeclaration namedDeclaration && !namedDeclaration.MayRename)
{
result = uniqueInherentName;
}
else if (boogieDeterminedNames.Contains(inherentName))
if (boogieDeterminedNames.Contains(inherentName))
{
result = uniqueInherentName;
}
Expand Down
12 changes: 12 additions & 0 deletions Test/datatypes/is-cons.bpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %parallel-boogie "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

datatype X {
A'(a: int),
B'(b: bool)
}

procedure P(x: X) {
assume x is A';
assert !(x is B');
}
2 changes: 2 additions & 0 deletions Test/datatypes/is-cons.bpl.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Boogie program verifier finished with 1 verified, 0 errors

0 comments on commit 4881964

Please sign in to comment.