Commit graph

9 commits

Author SHA1 Message Date
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
Leonardo de Moura
0126fa0499 refactor(kernel): add find_fn, replace for_each_fn with find_fn when appropriate, remove unnecessary function has_cached_type
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-19 13:03:46 -08:00
Leonardo de Moura
5cfcb7e144 chore(kernel/for_each): use consistent naming convetions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-19 11:24:02 -08:00
Leonardo de Moura
57d9d23bd4 feat(kernel/for_each): allow function F to interrupt for_each search
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 14:58:02 -07:00
Soonho Kong
ab6ca82e6f Update to suppress unused-parameter warnings 2013-09-19 22:40:34 -07:00
Soonho Kong
5c3866cd71 Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
Leonardo de Moura
5395ced0e5 Improve comments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
e5b8c45b3f Rename type to domain in contexts (aka telescopes). Reason: make name convention consistent with the one used for abstractions (lambdas and pis).
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:17 -07:00
Leonardo de Moura
338ce88ea0 Add occurs function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:17 -07:00