Commit 0d8141e3 authored by Marius Wachtler's avatar Marius Wachtler

Fix compvar 1 is 1.0 and 1.0 is 1 handling

parent 6b935b9b
......@@ -888,6 +888,9 @@ public:
if (!can_lower) {
// if the rhs is a float convert the lhs to a float and do the operation on it.
if (rhs->getType() == FLOAT) {
if (op_type == AST_TYPE::IsNot || op_type == AST_TYPE::Is)
return makeBool(op_type == AST_TYPE::IsNot);
ConcreteCompilerVariable* converted_left = var->makeConverted(emitter, INT);
llvm::Value* conv = emitter.getBuilder()->CreateSIToFP(converted_left->getValue(), g.double_);
converted_left->decvref(emitter);
......@@ -1115,6 +1118,9 @@ public:
if (rhs->getType() == FLOAT) {
converted_right = rhs->makeConverted(emitter, FLOAT);
} else {
if (op_type == AST_TYPE::IsNot || op_type == AST_TYPE::Is)
return makeBool(op_type == AST_TYPE::IsNot);
converted_right = rhs->makeConverted(emitter, INT);
llvm::Value* conv = emitter.getBuilder()->CreateSIToFP(converted_right->getValue(), g.double_);
converted_right->decvref(emitter);
......
......@@ -7,3 +7,10 @@ print c is C
print range is True
print c is None
print 1 is 1.0
print 1.0 is 1
print 1 is True
print 0 is False
print True is 1
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