Skip to content

Commit

Permalink
format_type can now format range_typet
Browse files Browse the repository at this point in the history
This adds formatting for range_typet as { from, ..., to }.
  • Loading branch information
kroening committed Sep 25, 2024
1 parent 4c59d28 commit 4b789bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util/format_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ std::ostream &format_rec(std::ostream &os, const typet &type)
return os << "\xe2\x84\xa4"; // u+2124, 'Z'
else if(id == ID_natural)
return os << "\xe2\x84\x95"; // u+2115, 'N'
else if(id == ID_range)
{
auto &range_type = to_range_type(type);
return os << "{ " << range_type.get_from() << ", ..., "
<< range_type.get_to() << " }";

Check warning on line 105 in src/util/format_type.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/format_type.cpp#L103-L105

Added lines #L103 - L105 were not covered by tests
}
else if(id == ID_rational)
return os << "\xe2\x84\x9a"; // u+211A, 'Q'
else if(id == ID_mathematical_function)
Expand Down
1 change: 1 addition & 0 deletions unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ SRC += analyses/ai/ai.cpp \
util/format.cpp \
util/format_expr.cpp \
util/format_number_range.cpp \
util/format_type.cpp \
util/get_base_name.cpp \
util/graph.cpp \
util/help_formatter.cpp \
Expand Down

0 comments on commit 4b789bf

Please sign in to comment.