annotate src/testdir/test_vim9_class.vim @ 31443:9ae3720f9bd9 v9.0.1054

patch 9.0.1054: object member can't get type from initializer Commit: https://github.com/vim/vim/commit/74e1274edf632b83d2948a2a2d519589eff52997 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 13 21:14:28 2022 +0000 patch 9.0.1054: object member can't get type from initializer Problem: Object member can't get type from initializer. Solution: If there is no type specified try to use the type of the initializer. Check for a valid type.
author Bram Moolenaar <Bram@vim.org>
date Tue, 13 Dec 2022 22:15:03 +0100
parents e572ff386670
children 5804270d6e9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31396
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test Vim9 classes
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source check.vim
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 import './vim9.vim' as v9
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 def Test_class_basic()
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 var lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 class NotWorking
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 v9.CheckScriptFailure(lines, 'E1316:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 class notWorking
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 v9.CheckScriptFailure(lines, 'E1314:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 class Not@working
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 v9.CheckScriptFailure(lines, 'E1315:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 abstract noclass Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 v9.CheckScriptFailure(lines, 'E475:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 abstract classy Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 v9.CheckScriptFailure(lines, 'E475:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endcl
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 v9.CheckScriptFailure(lines, 'E1065:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endclass school's out
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 v9.CheckScriptFailure(lines, 'E488:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 endclass | echo 'done'
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 v9.CheckScriptFailure(lines, 'E488:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 this
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 v9.CheckScriptFailure(lines, 'E1317:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 this.
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 v9.CheckScriptFailure(lines, 'E1317:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 this .count
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 v9.CheckScriptFailure(lines, 'E1317:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 this. count
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 v9.CheckScriptFailure(lines, 'E1317:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 this.count: number
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 that.count
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 v9.CheckScriptFailure(lines, 'E1318: Not a valid command in a class: that.count')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 this.count
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 v9.CheckScriptFailure(lines, 'E1022:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 this.count : number
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 v9.CheckScriptFailure(lines, 'E1059:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 class Something
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 this.count:number
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 v9.CheckScriptFailure(lines, 'E1069:')
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 lines =<< trim END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 vim9script
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 class TextPosition
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 this.lnum: number
31424
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
132 this.col: number
31416
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
133
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
134 def ToString(): string
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
135 return $'({this.lnum}, {this.col})'
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
136 enddef
31396
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 endclass
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138
31404
60b1d266548d patch 9.0.1035: object members are not being marked as used
Bram Moolenaar <Bram@vim.org>
parents: 31396
diff changeset
139 # use the automatically generated new() method
60b1d266548d patch 9.0.1035: object members are not being marked as used
Bram Moolenaar <Bram@vim.org>
parents: 31396
diff changeset
140 var pos = TextPosition.new(2, 12)
60b1d266548d patch 9.0.1035: object members are not being marked as used
Bram Moolenaar <Bram@vim.org>
parents: 31396
diff changeset
141 assert_equal(2, pos.lnum)
60b1d266548d patch 9.0.1035: object members are not being marked as used
Bram Moolenaar <Bram@vim.org>
parents: 31396
diff changeset
142 assert_equal(12, pos.col)
31416
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
143
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
144 # call an object method
f088f1d97eee patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents: 31404
diff changeset
145 assert_equal('(2, 12)', pos.ToString())
31396
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 END
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 v9.CheckScriptSuccess(lines)
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 enddef
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149
31424
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
150 def Test_class_member_initializer()
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
151 var lines =<< trim END
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
152 vim9script
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
153
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
154 class TextPosition
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
155 this.lnum: number = 1
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
156 this.col: number = 1
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
157
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
158 def new(lnum: number)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
159 this.lnum = lnum
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
160 enddef
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
161 endclass
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
162
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
163 var pos = TextPosition.new(3)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
164 assert_equal(3, pos.lnum)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
165 assert_equal(1, pos.col)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
166
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
167 var instr = execute('disassemble TextPosition.new')
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
168 assert_match('new\_s*' ..
31426
92afb904fbee patch 9.0.1046: class method disassemble test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 31424
diff changeset
169 '0 NEW TextPosition size \d\+\_s*' ..
31424
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
170 '\d PUSHNR 1\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
171 '\d STORE_THIS 0\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
172 '\d PUSHNR 1\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
173 '\d STORE_THIS 1\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
174 'this.lnum = lnum\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
175 '\d LOAD arg\[-1]\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
176 '\d PUSHNR 0\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
177 '\d LOAD $0\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
178 '\d\+ STOREINDEX object\_s*' ..
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
179 '\d\+ RETURN object.*',
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
180 instr)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
181 END
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
182 v9.CheckScriptSuccess(lines)
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
183 enddef
e31fc75f6aff patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents: 31416
diff changeset
184
31441
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
185 def Test_class_default_new()
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
186 var lines =<< trim END
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
187 vim9script
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
188
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
189 class TextPosition
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
190 this.lnum: number = 1
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
191 this.col: number = 1
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
192 endclass
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
193
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
194 var pos = TextPosition.new()
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
195 assert_equal(1, pos.lnum)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
196 assert_equal(1, pos.col)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
197
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
198 pos = TextPosition.new(v:none, v:none)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
199 assert_equal(1, pos.lnum)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
200 assert_equal(1, pos.col)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
201
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
202 pos = TextPosition.new(3, 22)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
203 assert_equal(3, pos.lnum)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
204 assert_equal(22, pos.col)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
205
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
206 pos = TextPosition.new(v:none, 33)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
207 assert_equal(1, pos.lnum)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
208 assert_equal(33, pos.col)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
209 END
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
210 v9.CheckScriptSuccess(lines)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
211
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
212 lines =<< trim END
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
213 vim9script
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
214 class Person
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
215 this.name: string
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
216 this.age: number = 42
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
217 this.education: string = "unknown"
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
218
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
219 def new(this.name, this.age = v:none, this.education = v:none)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
220 enddef
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
221 endclass
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
222
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
223 var piet = Person.new("Piet")
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
224 assert_equal("Piet", piet.name)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
225 assert_equal(42, piet.age)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
226 assert_equal("unknown", piet.education)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
227
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
228 var chris = Person.new("Chris", 4, "none")
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
229 assert_equal("Chris", chris.name)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
230 assert_equal(4, chris.age)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
231 assert_equal("none", chris.education)
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
232 END
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
233 v9.CheckScriptSuccess(lines)
31443
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
234
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
235 lines =<< trim END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
236 vim9script
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
237 class Person
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
238 this.name: string
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
239 this.age: number = 42
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
240 this.education: string = "unknown"
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
241
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
242 def new(this.name, this.age = v:none, this.education = v:none)
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
243 enddef
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
244 endclass
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
245
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
246 var missing = Person.new()
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
247 END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
248 v9.CheckScriptFailure(lines, 'E119:')
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
249 enddef
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
250
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
251 def Test_class_object_member_inits()
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
252 var lines =<< trim END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
253 vim9script
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
254 class TextPosition
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
255 this.lnum: number
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
256 this.col = 1
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
257 this.addcol: number = 2
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
258 endclass
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
259
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
260 var pos = TextPosition.new()
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
261 assert_equal(0, pos.lnum)
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
262 assert_equal(1, pos.col)
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
263 assert_equal(2, pos.addcol)
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
264 END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
265 v9.CheckScriptSuccess(lines)
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
266
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
267 lines =<< trim END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
268 vim9script
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
269 class TextPosition
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
270 this.lnum
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
271 this.col = 1
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
272 endclass
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
273 END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
274 v9.CheckScriptFailure(lines, 'E1022:')
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
275
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
276 lines =<< trim END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
277 vim9script
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
278 class TextPosition
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
279 this.lnum = v:none
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
280 this.col = 1
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
281 endclass
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
282 END
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
283 v9.CheckScriptFailure(lines, 'E1330:')
31441
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
284 enddef
e572ff386670 patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents: 31426
diff changeset
285
31396
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286
31443
9ae3720f9bd9 patch 9.0.1054: object member can't get type from initializer
Bram Moolenaar <Bram@vim.org>
parents: 31441
diff changeset
287
31396
307f68a41b03 patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker