Commit 7f4f7fa6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Not in the best way, but fix an issue with augassign type inference

parent 47bfc80c
......@@ -371,10 +371,19 @@ class BasicBlockTypePropagator : public ExprVisitor, public StmtVisitor {
name = "__i" + name.substr(2);
CompilerType *attr_type = t->getattrType(&name, true);
ASSERT(attr_type != UNDEF, "need to implement the actual semantics here");
std::vector<CompilerType*> arg_types;
arg_types.push_back(v);
CompilerType *rtn = attr_type->callType(arg_types);
if (VERBOSITY() >= 2) printf("%s aug= %s -> %s\n", t->debugName().c_str(), v->debugName().c_str(), rtn->debugName().c_str());
if (t == INT && v == INT)
assert(rtn == INT);
if (t == FLOAT && v == FLOAT)
assert(rtn == FLOAT);
_doSet(node->target, rtn);
}
......
......@@ -606,6 +606,10 @@ class IntType : public ConcreteCompilerType {
return AbstractFunctionType::get(sigs);
}
if (*attr == "__iadd__" || *attr == "__isub__" || *attr == "__imod__" || *attr == "__imul__" || *attr == "__ilshift__" || *attr == "__irshift__" || *attr == "__idiv__" || *attr == "__ipow__" || *attr == "__ifloordiv__" || *attr == "__iand__" || *attr == "__ior__" || *attr == "__ixor__") {
return AbstractFunctionType::get(sigs);
}
return BOXED_INT->getattrType(attr, cls_only);
}
......@@ -715,6 +719,10 @@ class FloatType : public ConcreteCompilerType {
return AbstractFunctionType::get(sigs);
}
if (*attr == "__iadd__" || *attr == "__isub__" || *attr == "__imul__" || *attr == "__idiv__" || *attr == "__ipow__" || *attr == "__ifloordiv__" || *attr == "__imod__" || *attr == "__ipow__") {
return AbstractFunctionType::get(sigs);
}
return BOXED_FLOAT->getattrType(attr, cls_only);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment