Fixes two issues with our check for datatype subfields (isFunctionLike -> isFirstClass): functions should be allowed, RegLan should not.
Fixes cvc5/cvc5-projects#368. That issue now throws an error:
(error "Parse Error: proj-368.smt2:3.39: cannot use fields in datatypes that are not first class types
(declare-datatype x ((_x (x8 RegLan))))
^
")
This adds a regression showing we allow functions as subfields.
// This next one's a "hard" check, performed in non-debug builds
// as well; the other ones should all be guaranteed by the
// cvc5::DType class, but this actually needs to be checked.
- if (selectorType.getRangeType().isFunctionLike())
+ if (!selectorType.getRangeType().isFirstClass())
{
- throw Exception("cannot put function-like things in datatypes");
+ throw Exception(
+ "cannot use fields in datatypes that are not first class types");
}
}
}
namespace strings {
RegExpEnumerator::RegExpEnumerator(TypeNode type, TypeEnumeratorProperties* tep)
- : TypeEnumeratorBase<RegExpEnumerator>(type), d_senum(type, tep)
+ : TypeEnumeratorBase<RegExpEnumerator>(type),
+ d_senum(NodeManager::currentNM()->stringType(), tep)
{
}
regress0/ho/bug_nodbuilding_interpreted_SYO042^1.p
regress0/ho/cong-full-apply.smt2
regress0/ho/cong.smt2
+ regress0/ho/datatype-field-ho.smt2
regress0/ho/declare-fun-variants.smt2
regress0/ho/def-fun-flatten.smt2
regress0/ho/ext-finite-unsat.smt2
--- /dev/null
+(set-logic HO_ALL)
+(set-info :status sat)
+(declare-datatype x ((C (s (-> Int Int)))))
+(declare-fun x1 () x)
+(declare-fun x2 () x)
+(assert (distinct x1 x2))
+(check-sat)