[vim/vim] Using a null partial in filter() crashes Vim (#5976)

7 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Apr 24, 2020, 1:08:08 PM4/24/20
to vim/vim, Subscribed

Fix the crash when using a null partial function in filter().
When comparing two null partials return True.
Add additional test for eval functionality.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/5976

Commit Summary

  • Using a null partial in filter() crashes Vim. Comparing two null partial returns False.

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Dominique Pellé

unread,
Apr 24, 2020, 1:18:54 PM4/24/20
to vim/vim, Subscribed

@dpelle commented on this pull request.


In src/testdir/test_expr.vim:

> @@ -583,4 +585,14 @@ func Test_expr_eval_error()
   call assert_fails("let v = -{}", 'E728:')
 endfunc
 
+" Test for float value comparison
+func Test_float_compare()
+  call assert_true(1.2 == 1.2)
+  call assert_true(1.0 != 1.2)
+  call assert_true(1.2 > 1.0)
+  call assert_true(1.2 >= 1.2)
+  call assert_true(1.0 < 1.2)
+  call assert_true(1.2 <= 1.2)

How about testing:

  • NaN (which is never equal to anything, including itself)
  • +infinity
  • -infinity
  • +0.0 and -0.0 (which should be equal despite having different representation)

Yegappan Lakshmanan

unread,
Apr 24, 2020, 1:55:37 PM4/24/20
to vim_dev, reply+ACY5DGAE4OGF6FWWJQ...@reply.github.com, vim/vim, Subscribed
Hi Dominique,

On Fri, Apr 24, 2020 at 10:18 AM Dominique Pellé <vim-dev...@256bit.org> wrote:

@dpelle commented on this pull request.


In src/testdir/test_expr.vim:

> @@ -583,4 +585,14 @@ func Test_expr_eval_error()
   call assert_fails("let v = -{}", 'E728:')
 endfunc
 
+" Test for float value comparison
+func Test_float_compare()
+  call assert_true(1.2 == 1.2)
+  call assert_true(1.0 != 1.2)
+  call assert_true(1.2 > 1.0)
+  call assert_true(1.2 >= 1.2)
+  call assert_true(1.0 < 1.2)
+  call assert_true(1.2 <= 1.2)

How about testing:

  • NaN (which is never equal to anything, including itself)
  • +infinity
  • -infinity
  • +0.0 and -0.0 (which should be equal despite having different representation)

I will add these cases.

Thanks,
Yegappan 

vim-dev ML

unread,
Apr 24, 2020, 1:55:51 PM4/24/20
to vim/vim, vim-dev ML, Your activity

Hi Dominique,

On Fri, Apr 24, 2020 at 10:18 AM Dominique Pellé <vim-dev...@256bit.org>
wrote:

> *@dpelle* commented on this pull request.
> ------------------------------
>
> In src/testdir/test_expr.vim
> <https://github.com/vim/vim/pull/5976#discussion_r414735853>:

>
> > @@ -583,4 +585,14 @@ func Test_expr_eval_error()
> call assert_fails("let v = -{}", 'E728:')
> endfunc
>
> +" Test for float value comparison
> +func Test_float_compare()
> + call assert_true(1.2 == 1.2)
> + call assert_true(1.0 != 1.2)
> + call assert_true(1.2 > 1.0)
> + call assert_true(1.2 >= 1.2)
> + call assert_true(1.0 < 1.2)
> + call assert_true(1.2 <= 1.2)
>
> How about testing:
>
> - NaN (which is never equal to anything, including itself)
> - +infinity
> - -infinity
> - +0.0 and -0.0 (which should be equal despite having different

> representation)
>
>
I will add these cases.

Thanks,
Yegappan

Yegappan Lakshmanan

unread,
Apr 24, 2020, 2:14:01 PM4/24/20
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

Bram Moolenaar

unread,
Apr 24, 2020, 4:48:00 PM4/24/20
to vim/vim, vim-dev ML, Comment

Closed #5976 via 9d8d0b5.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages