Allow variables be assigned to other types if they are implicitly castable
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9520b98f2e
commit
54778adf82
|
@ -101,9 +101,13 @@ namespace Porygon::Binder {
|
||||||
} else {
|
} else {
|
||||||
// Assigning
|
// Assigning
|
||||||
auto var = this->GetVariable(exists, identifier);
|
auto var = this->GetVariable(exists, identifier);
|
||||||
if (var->GetType()->operator!=(type)) {
|
auto t= var->GetType();
|
||||||
|
if (t->operator!=(type)) {
|
||||||
|
auto castResult = type->CastableTo(t, false);
|
||||||
|
if (castResult == CastResult::InvalidCast){
|
||||||
return VariableAssignment(VariableAssignmentResult::VariableDefinedWithDifferentType, nullptr);
|
return VariableAssignment(VariableAssignmentResult::VariableDefinedWithDifferentType, nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return VariableAssignment(VariableAssignmentResult::Ok, new BoundVariableKey(identifier, exists, false, type));
|
return VariableAssignment(VariableAssignmentResult::Ok, new BoundVariableKey(identifier, exists, false, type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue