Skip to content

Commit

Permalink
Fix bug in cast from real to interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsmmr committed Dec 3, 2022
1 parent 258565a commit 25d9595
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hilti/toolchain/src/compiler/codegen/operators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ struct Visitor : hilti::visitor::PreOrder<cxx::Expression, Visitor> {
/// Real

result_t operator()(const operator_::real::CastToInterval& n) {
return fmt("::hilti::rt::Interval(%f, hilti::rt::Interval::NanosecondTag())", op0(n));
return fmt("::hilti::rt::Interval(%f, hilti::rt::Interval::SecondTag())", op0(n));
}
result_t operator()(const operator_::real::CastToTime& n) {
return fmt("::hilti::rt::Time(%f, hilti::rt::Time::SecondTag())", op0(n));
Expand Down
1 change: 1 addition & 0 deletions tests/hilti/types/interval/ops.hlt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ assert i1 >= i1;
assert i2 <= i2;

assert cast<interval>(5) == interval(5.0);
assert cast<interval>(5.0) == interval(5.0);

}

0 comments on commit 25d9595

Please sign in to comment.