summaryrefslogtreecommitdiff
path: root/src/expr
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-06-07 11:30:00 -0400
committerMorgan Deters <mdeters@cs.nyu.edu>2013-06-07 16:02:56 -0400
commit0d8c1936b8b8159af5f6688e63d74a806f48ac75 (patch)
treedb0ac86baefc3f93e363f797a379ba9fdc0eb68c /src/expr
parent931b5641dfffcd3779239e014406aa057e21e0f7 (diff)
Fix for bug 517.
Diffstat (limited to 'src/expr')
-rw-r--r--src/expr/type_node.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/expr/type_node.cpp b/src/expr/type_node.cpp
index e654b5d71..1d4c330fa 100644
--- a/src/expr/type_node.cpp
+++ b/src/expr/type_node.cpp
@@ -123,6 +123,15 @@ bool TypeNode::isSubtypeOf(TypeNode t) const {
}
return true;
}
+ if(isFunction()) {
+ // A function is a subtype of another if the args are the same type, and
+ // the return type is a subtype of the other's. This is enough for now
+ // (and it's necessary for model generation, since a Real-valued function
+ // might return a constant Int and thus the model value is typed differently).
+ return t.isFunction() &&
+ getArgTypes() == t.getArgTypes() &&
+ getRangeType().isSubtypeOf(t.getRangeType());
+ }
if(isPredicateSubtype()) {
return getSubtypeParentType().isSubtypeOf(t);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback