lean2/src/util
Leonardo de Moura f80106a895 chore(*): use 'explicit operator bool' everywhere.
operator bool() may produce unwanted conversions.
For example, we had the following bug in the code base.

...
   object const & obj = find_object(const_name(n));
   if (obj && obj.is_builtin() && obj.get_name() == n)
...

obj.get_name() has type lean::name
n              has type lean::expr

Both have 'operator bool()', then the compiler uses the operator to
convert them to Boolean, and then compare the result.
Of course, this is not our intention.

After this commit, the compiler correctly signs the error.
The correct code is

...
   object const & obj = find_object(const_name(n));
   if (obj && obj.is_builtin() && obj.get_name() == const_name(n))
...

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 23:02:45 -08:00
..
interval fix(util/interval): add missing explicit template instantiation 2013-11-20 09:56:19 -08:00
numerics refactor(frontends/lua): rename leanlua_state to script_state, and move it to util 2013-11-27 14:57:36 -08:00
polynomial feat(polynomial): add multivariate polynomials 2013-10-21 18:22:14 -07:00
sexpr chore(*): use 'explicit operator bool' everywhere. 2013-12-02 23:02:45 -08:00
ascii.cpp Modify Doxygen file to extract all elements even the undocumented ones. Disable warnings for undocumented entities. Add extra comments. 2013-09-13 13:46:22 -07:00
ascii.h Create pp::unicode option. The idea is to be able to disable unicode characters, but still be able to use mixfix notation. 2013-09-03 10:11:45 -07:00
bit_tricks.cpp Fix bugs in mpbq. 2013-07-21 20:12:04 -07:00
bit_tricks.h Fix bugs in mpbq. 2013-07-21 20:12:04 -07:00
buffer.h chore(emplace_back): use emplace_back when appropriate 2013-11-10 11:14:04 -08:00
CMakeLists.txt feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
debug.cpp Update to suppress unused-parameter warnings 2013-09-19 22:40:34 -07:00
debug.h refactor(util/lua): propagate C++ Lean exceptions in Lua 2013-11-27 12:25:29 -08:00
escaped.cpp Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
escaped.h Improve documentation 2013-07-26 11:43:53 -07:00
exception.cpp refactor(util/lua): propagate C++ Lean exceptions in Lua 2013-11-27 12:25:29 -08:00
exception.h feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
flet.h Track recursion depth at normalizer. Add fluid let template. 2013-08-23 09:42:49 -07:00
hash.cpp Remove invalid use of register 2013-09-19 22:59:39 -07:00
hash.h Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
int64.h feat(numerics): add finite field Z/pZ 2013-10-18 13:27:28 -07:00
interrupt.cpp feat(library/tactic): add support for migratic tactic framework object between Lua states 2013-11-28 08:03:05 -08:00
interrupt.h feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
interruptable_ptr.h Add Ctrl-C support for interrupting Lean shell. 2013-08-24 16:11:35 -07:00
lazy_list.h refactor(util/lazy_list): polish lazy_list API 2013-11-23 17:45:01 -08:00
lazy_list_fn.h feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
list.h chore(*): use 'explicit operator bool' everywhere. 2013-12-02 23:02:45 -08:00
list_fn.h fix(util/list): bug in map template 2013-12-01 08:51:24 -08:00
lua.cpp feat(library/tactic): execute Lua tactics using coroutines 2013-11-28 13:09:33 -08:00
lua.h feat(library/tactic): execute Lua tactics using coroutines 2013-11-28 13:09:33 -08:00
luaref.cpp fix(util/luaref): warnings produced by valgrind 2013-11-30 00:34:38 -08:00
luaref.h fix(util/luaref): warnings produced by valgrind 2013-11-30 00:34:38 -08:00
map.h Add helper function for maps. 2013-08-14 18:17:18 -07:00
memory.cpp fix(util/memory): make sure realloc behaves like free when sz == 0 2013-11-11 13:42:22 -08:00
memory.h Track memory usage. Add new CMake option TRACK_MEMORY_USAGE (It is ON by default). 2013-09-20 12:32:12 -07:00
name.cpp refactor(frontends/lua): add lua_migrate_fn, and make copy_values modular 2013-11-27 10:32:19 -08:00
name.h chore(*): use 'explicit operator bool' everywhere. 2013-12-02 23:02:45 -08:00
name_generator.h feat(elaborator): solve unification constraints 2013-10-22 08:15:36 -07:00
name_set.cpp feat(util/name_set): add mk_unique (with respect to a name_set) 2013-11-30 11:28:38 -08:00
name_set.h feat(util/name_set): add mk_unique (with respect to a name_set) 2013-11-30 11:28:38 -08:00
optional.h chore(*): use 'explicit operator bool' everywhere. 2013-12-02 23:02:45 -08:00
output_channel.h Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
pair.h Add options to customize formatter 2013-08-13 16:19:30 -07:00
pdeque.h chore(*): add LCOV_EXCL_LINE to lean_unreachable statements 2013-11-11 09:19:38 -08:00
pvector.h chore(*): add LCOV_EXCL_LINE to lean_unreachable statements 2013-11-11 09:19:38 -08:00
rc.h feat(make): add THREAD_SAFE build option 2013-10-25 11:50:35 -07:00
realpath.cpp fix(util/realpath): style 2013-11-18 09:55:16 -08:00
realpath.h fix(kernel/environment): compilation problem on Windows 2013-11-18 09:52:47 -08:00
safe_arith.cpp Fix cpplint warning in util/safe_arith.cpp 2013-09-16 19:12:12 -07:00
safe_arith.h Simplify how universe variable constraints are represented in the kernel. Allow universe variable to be created without an environment. 2013-08-05 20:06:42 -07:00
scoped_map.h chore(emplace_back): use emplace_back when appropriate 2013-11-10 11:14:04 -08:00
scoped_set.h chore(emplace_back): use emplace_back when appropriate 2013-11-10 11:14:04 -08:00
script_exception.cpp chore(*): fix cygwin compilation errors 2013-11-28 13:49:18 -08:00
script_exception.h refactor(frontends/lua): rename leanlua_state to script_state, and move it to util 2013-11-27 14:57:36 -08:00
script_state.cpp fix(library/tactic): memory leaks 2013-11-30 00:44:39 -08:00
script_state.h fix(library/tactic): memory leaks 2013-11-30 00:44:39 -08:00
shared_mutex.cpp feat(util/shared_mutex): add support for recursive lock at shared_mutex 2013-11-15 22:01:11 -08:00
shared_mutex.h feat(util/shared_mutex): add support for recursive lock at shared_mutex 2013-11-15 22:01:11 -08:00
splay_map.cpp refactor(bindings/lua): move Lua bindings to the file associated with them 2013-11-26 19:15:56 -08:00
splay_map.h refactor(bindings/lua): move Lua bindings to the file associated with them 2013-11-26 19:15:56 -08:00
splay_tree.h chore(util): use && when appropriate 2013-11-21 17:29:06 -08:00
sstream.h Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
stackinfo.cpp fix(util/stackinfo): handle error codes in the Linux version 2013-12-02 07:56:53 -08:00
stackinfo.h feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
test.h feat(util): add primitives for checking the amount of available stack space 2013-12-01 17:19:27 -08:00
timeit.h Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
trace.cpp Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
trace.h Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
unlock_guard.h refactor(util/script_state): replace std::recursive_mutex with std::mutex, and use unlock_guard 2013-11-27 15:40:41 -08:00