if( in.getType().isSort() ){
TypeEnumerator te(in.getType());
gt = *te;
- }else{
+ }else if( dt.isWellFounded() || in[0].isConst() ){
gt = in.getType().mkGroundTerm();
}
- TypeNode gtt = gt.getType();
- //Assert( gtt.isDatatype() || gtt.isParametricDatatype() );
- if( gtt.isDatatype() && !gtt.isInstantiatedDatatype() ){
- gt = NodeManager::currentNM()->mkNode(kind::APPLY_TYPE_ASCRIPTION,
- NodeManager::currentNM()->mkConst(AscriptionType(in.getType().toType())), gt);
+ if( !gt.isNull() ){
+ TypeNode gtt = gt.getType();
+ //Assert( gtt.isDatatype() || gtt.isParametricDatatype() );
+ if( gtt.isDatatype() && !gtt.isInstantiatedDatatype() ){
+ gt = NodeManager::currentNM()->mkNode(kind::APPLY_TYPE_ASCRIPTION,
+ NodeManager::currentNM()->mkConst(AscriptionType(in.getType().toType())), gt);
+ }
+ Trace("datatypes-rewrite") << "DatatypesRewriter::postRewrite: "
+ << "Rewrite trivial selector " << in
+ << " to distinguished ground term "
+ << in.getType().mkGroundTerm() << std::endl;
+ return RewriteResponse(REWRITE_DONE,gt );
}
- Trace("datatypes-rewrite") << "DatatypesRewriter::postRewrite: "
- << "Rewrite trivial selector " << in
- << " to distinguished ground term "
- << in.getType().mkGroundTerm() << std::endl;
- return RewriteResponse(REWRITE_DONE,gt );
}
}
if(in.getKind() == kind::DT_SIZE && in[0].getKind()==kind::APPLY_CONSTRUCTOR ){
}
}
}
- //add this to the transitive closure module
- Node oldRep = trep2;
- Node newRep = trep1;
- if( trep1.getKind()!=APPLY_CONSTRUCTOR && trep2.getKind()==APPLY_CONSTRUCTOR ){
- oldRep = trep1;
- newRep = trep2;
- }
- /*
- bool result = d_cycle_check.addEdgeNode( oldRep, newRep );
- //d_hasSeenCycle.set( d_hasSeenCycle.get() || result );
- Debug("datatypes-cycles") << "DtCyc: Equal " << oldRep << " -> " << newRep << " " << result << " " << d_hasSeenCycle.get() << endl;
- if( result ){
- checkCycles();
- if( d_conflict ){
- Debug("datatypes-cycles-find") << "Cycle found." << std::endl;
- return;
- }else{
- Debug("datatypes-cycles-find") << "WARNING : no cycle found." << std::endl;
- d_cycle_check.debugPrint();
- }
- }
- */
}
}