diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2013-06-07 11:30:00 -0400 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-06-07 16:02:56 -0400 |
commit | 0d8c1936b8b8159af5f6688e63d74a806f48ac75 (patch) | |
tree | db0ac86baefc3f93e363f797a379ba9fdc0eb68c /src/expr | |
parent | 931b5641dfffcd3779239e014406aa057e21e0f7 (diff) |
Fix for bug 517.
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/type_node.cpp | 9 |
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); } |