Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 21455:8cc1555f2445 v8.2.1278
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Commit: https://github.com/vim/vim/commit/dd1a9af00f6954b176c5875af0a91acde72572c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 23 15:38:03 2020 +0200
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Problem: Vim9: line break after "->" only allowed in :def function.
Solution: Only allow line break after "->". (closes https://github.com/vim/vim/issues/6492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 23 Jul 2020 15:45:06 +0200 |
parents | a6c316ef161a |
children | b5d4ab124782 |
comparison
equal
deleted
inserted
replaced
21454:c50b04b76bc2 | 21455:8cc1555f2445 |
---|---|
1458 return arg | 1458 return arg |
1459 enddef | 1459 enddef |
1460 | 1460 |
1461 def Test_expr7_call() | 1461 def Test_expr7_call() |
1462 assert_equal('yes', 'yes'->Echo()) | 1462 assert_equal('yes', 'yes'->Echo()) |
1463 assert_equal('yes', 'yes'->s:EchoArg()) | 1463 assert_equal('yes', 'yes' |
1464 ->s:EchoArg()) | |
1464 assert_equal(1, !range(5)->empty()) | 1465 assert_equal(1, !range(5)->empty()) |
1465 assert_equal([0, 1, 2], --3->range()) | 1466 assert_equal([0, 1, 2], --3->range()) |
1466 | 1467 |
1467 call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:') | 1468 call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:') |
1468 enddef | 1469 enddef |
1528 call CheckDefExecFailure(["let x = +g:ablob"], 'E974:') | 1529 call CheckDefExecFailure(["let x = +g:ablob"], 'E974:') |
1529 call CheckDefExecFailure(["let x = +g:alist"], 'E745:') | 1530 call CheckDefExecFailure(["let x = +g:alist"], 'E745:') |
1530 call CheckDefExecFailure(["let x = +g:adict"], 'E728:') | 1531 call CheckDefExecFailure(["let x = +g:adict"], 'E728:') |
1531 | 1532 |
1532 call CheckDefFailure(["let x = ''", "let y = x.memb"], 'E715:') | 1533 call CheckDefFailure(["let x = ''", "let y = x.memb"], 'E715:') |
1534 | |
1535 call CheckDefFailure(["'yes'->", "Echo()"], 'E488:') | |
1533 | 1536 |
1534 call CheckDefExecFailure(["[1, 2->len()"], 'E697:') | 1537 call CheckDefExecFailure(["[1, 2->len()"], 'E697:') |
1535 call CheckDefExecFailure(["#{a: 1->len()"], 'E488:') | 1538 call CheckDefExecFailure(["#{a: 1->len()"], 'E488:') |
1536 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:') | 1539 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:') |
1537 endfunc | 1540 endfunc |
1589 enddef | 1592 enddef |
1590 | 1593 |
1591 def Test_expr7_subscript_linebreak() | 1594 def Test_expr7_subscript_linebreak() |
1592 let range = range( | 1595 let range = range( |
1593 3) | 1596 3) |
1594 let l = range-> | 1597 let l = range |
1595 map('string(v:key)') | 1598 ->map('string(v:key)') |
1596 assert_equal(['0', '1', '2'], l) | 1599 assert_equal(['0', '1', '2'], l) |
1597 | 1600 |
1598 l = range | 1601 l = range |
1599 ->map('string(v:key)') | 1602 ->map('string(v:key)') |
1600 assert_equal(['0', '1', '2'], l) | 1603 assert_equal(['0', '1', '2'], l) |