Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 20532:cb4831fa7e25 v8.2.0820
patch 8.2.0820: Vim9: function type isn't set until compiled
Commit: https://github.com/vim/vim/commit/6ff71d8b7fbdf667a2f119a2487302e240961816
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 24 23:45:24 2020 +0200
patch 8.2.0820: Vim9: function type isn't set until compiled
Problem: Vim9: function type isn't set until compiled.
Solution: Set function type early.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 25 May 2020 00:00:04 +0200 |
parents | 489cb75c76b6 |
children | 54ffae914876 |
comparison
equal
deleted
inserted
replaced
20531:6eb8347bcf1a | 20532:cb4831fa7e25 |
---|---|
558 def Test_func_type_part() | 558 def Test_func_type_part() |
559 let RefVoid: func: void | 559 let RefVoid: func: void |
560 RefVoid = FuncNoArgNoRet | 560 RefVoid = FuncNoArgNoRet |
561 RefVoid = FuncOneArgNoRet | 561 RefVoid = FuncOneArgNoRet |
562 CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number') | 562 CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number') |
563 " TODO: these should fail | 563 CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetString'], 'E1013: type mismatch, expected func() but got func(): string') |
564 " CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetString'], 'E1013: type mismatch, expected func() but got func(): string') | |
565 | 564 |
566 let RefAny: func(): any | 565 let RefAny: func(): any |
567 RefAny = FuncNoArgRetNumber | 566 RefAny = FuncNoArgRetNumber |
568 RefAny = FuncNoArgRetString | 567 RefAny = FuncNoArgRetString |
569 CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): any but got func()') | 568 CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): any but got func()') |
571 | 570 |
572 let RefNr: func: number | 571 let RefNr: func: number |
573 RefNr = FuncNoArgRetNumber | 572 RefNr = FuncNoArgRetNumber |
574 RefNr = FuncOneArgRetNumber | 573 RefNr = FuncOneArgRetNumber |
575 CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): number but got func()') | 574 CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): number but got func()') |
576 " TODO: should fail | 575 CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgRetString'], 'E1013: type mismatch, expected func(): number but got func(): string') |
577 " CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgRetString'], 'E1013: type mismatch, expected func(): number but got func(): string') | |
578 | 576 |
579 let RefStr: func: string | 577 let RefStr: func: string |
580 RefStr = FuncNoArgRetString | 578 RefStr = FuncNoArgRetString |
581 RefStr = FuncOneArgRetString | 579 RefStr = FuncOneArgRetString |
582 CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): string but got func()') | 580 CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): string but got func()') |
587 CheckDefFailure(['let ref1: func()'], 'E704:') | 585 CheckDefFailure(['let ref1: func()'], 'E704:') |
588 | 586 |
589 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number') | 587 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number') |
590 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgNoRet'], 'E1013: type mismatch, expected func() but got func(number)') | 588 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgNoRet'], 'E1013: type mismatch, expected func() but got func(number)') |
591 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgRetNumber'], 'E1013: type mismatch, expected func() but got func(number): number') | 589 CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgRetNumber'], 'E1013: type mismatch, expected func() but got func(number): number') |
592 " TODO: these don't fail | 590 CheckDefFailure(['let Ref1: func(bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(bool) but got func(bool, number)') |
593 " CheckDefFailure(['let Ref1: func(bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(bool) but got func(bool, number)') | 591 CheckDefFailure(['let Ref1: func(?bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(?bool) but got func(bool, number)') |
594 " CheckDefFailure(['let Ref1: func(?bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(?bool) but got func(bool, number)') | 592 CheckDefFailure(['let Ref1: func(...bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(...bool) but got func(bool, number)') |
595 " CheckDefFailure(['let Ref1: func(...bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(...bool) but got func(bool, number)') | |
596 | 593 |
597 call CheckDefFailure(['let RefWrong: func(string ,number)'], 'E1068:') | 594 call CheckDefFailure(['let RefWrong: func(string ,number)'], 'E1068:') |
598 call CheckDefFailure(['let RefWrong: func(string,number)'], 'E1069:') | 595 call CheckDefFailure(['let RefWrong: func(string,number)'], 'E1069:') |
599 call CheckDefFailure(['let RefWrong: func(bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool)'], 'E740:') | 596 call CheckDefFailure(['let RefWrong: func(bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool)'], 'E740:') |
600 call CheckDefFailure(['let RefWrong: func(bool):string'], 'E1069:') | 597 call CheckDefFailure(['let RefWrong: func(bool):string'], 'E1069:') |