From c8015e6dc858a3fd13234ec4acb22c80cb339ddc Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Fri, 5 Jun 2020 17:57:25 -0500 Subject: Datatypes with nested recursion are not handled in TheoryDatatypes unless option is set (#3707) Towards experimental support for non-simply recursive datatypes (https://github.com/ajreynol/CVC4/tree/dtNonSimpleRec). Builds a check for non-simple recursion in the DType class. If a term of a datatype type is registered to TheoryDatatypes for a datatype that has nested recursion, we throw a LogicException unless the option dtNestedRec is set to true. Also includes a bug discovered in the TypeMatcher utility and another in expr::getComponentTypes. It also adds a unit test using the new API for a simple parametric datatype example as well, not related to nested recursion, as this was previously missing. --- test/unit/parser/parser_black.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/unit/parser') diff --git a/test/unit/parser/parser_black.h b/test/unit/parser/parser_black.h index a829d9a8d..f1691edd4 100644 --- a/test/unit/parser/parser_black.h +++ b/test/unit/parser/parser_black.h @@ -254,7 +254,10 @@ public: tryGoodInput("DATATYPE list = nil | cons(car:INT,cdr:list) END; DATATYPE cons = null END;"); tryGoodInput("DATATYPE tree = node(data:list), list = cons(car:tree,cdr:list) | nil END;"); //tryGoodInput("DATATYPE tree = node(data:[list,list,ARRAY tree OF list]), list = cons(car:ARRAY list OF tree,cdr:BITVECTOR(32)) END;"); - tryGoodInput("DATATYPE trex = Foo | Bar END; DATATYPE tree = node(data:[list,list,ARRAY trex OF list]), list = cons(car:ARRAY list OF tree,cdr:BITVECTOR(32)) END;"); + tryGoodInput( + "DATATYPE trex = Foo | Bar END; DATATYPE tree = " + "node(data:[list,list,ARRAY trex OF list]), list = cons(car:ARRAY list " + "OF tree,cdr:BITVECTOR(32)) END;"); } void testBadCvc4Inputs() { -- cgit v1.2.3