Skip to content

Commit cb93795

Browse files
committed
More fixes in simplestValue and hasInstance
1 parent f5a5ebd commit cb93795

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/scala/inox/ast/SymbolOps.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,8 @@ trait SymbolOps { self: TypeOps =>
912912
case adt: ADTType =>
913913
val sort = adt.getSort
914914
val cons = sort.constructors.sortBy(_.fields.size).head
915-
if (sort.hasInvariant) None
915+
if (seen(adt)) None
916+
else if (sort.hasInvariant) None
916917
else if (!sort.definition.isWellFormed) Some(false)
917918
else if (sort.constructors.sortBy(_.fields.size).exists(cons =>
918919
cons.fields.forall(vd => hasInstance(vd.tpe, seen + adt) contains true)))
@@ -945,8 +946,9 @@ trait SymbolOps { self: TypeOps =>
945946
val sort = adt.getSort
946947
if (!sort.definition.isWellFormed) throw NoSimpleValue(adt)
947948

948-
if (seen(adt) && inLambda) {
949-
Choose(ValDef.fresh("res", adt), BooleanLiteral(true))
949+
if (seen(adt)) {
950+
if (inLambda) Choose(ValDef.fresh("res", adt), BooleanLiteral(true))
951+
else throw NoSimpleValue(adt)
950952
} else if (sort.hasInvariant) {
951953
if (!allowSolver) throw NoSimpleValue(adt)
952954

0 commit comments

Comments
 (0)