@@ -20,6 +20,20 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
20
20
|""" .stripMargin
21
21
)
22
22
23
+ @ Test def `simple-old-syntax` =
24
+ check(
25
+ """ |package example
26
+ |
27
+ |object Test:
28
+ | implicit class TestOps(a: Int):
29
+ | def testOps(b: Int): String = ???
30
+ |
31
+ |def main = 100.test@@
32
+ |""" .stripMargin,
33
+ """ |testOps(b: Int): String (implicit)
34
+ |""" .stripMargin
35
+ )
36
+
23
37
@ Test def `simple2` =
24
38
check(
25
39
""" |package example
@@ -35,6 +49,21 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
35
49
filter = _.contains(" (extension)" )
36
50
)
37
51
52
+ @ Test def `simple2-old-syntax` =
53
+ check(
54
+ """ |package example
55
+ |
56
+ |object enrichments:
57
+ | implicit class TestOps(a: Int):
58
+ | def testOps(b: Int): String = ???
59
+ |
60
+ |def main = 100.t@@
61
+ |""" .stripMargin,
62
+ """ |testOps(b: Int): String (implicit)
63
+ |""" .stripMargin,
64
+ filter = _.contains(" (implicit)" )
65
+ )
66
+
38
67
@ Test def `filter-by-type` =
39
68
check(
40
69
""" |package example
@@ -52,6 +81,22 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
52
81
filter = _.contains(" (extension)" )
53
82
)
54
83
84
+ @ Test def `filter-by-type-old` =
85
+ check(
86
+ """ |package example
87
+ |
88
+ |object enrichments:
89
+ | implicit class A(num: Int):
90
+ | def identity2: Int = num + 1
91
+ | implicit class B(str: String):
92
+ | def identity: String = str
93
+ |
94
+ |def main = "foo".iden@@
95
+ |""" .stripMargin,
96
+ """ |identity: String (implicit)
97
+ |""" .stripMargin // identity2 won't be available
98
+ )
99
+
55
100
@ Test def `filter-by-type-subtype` =
56
101
check(
57
102
""" |package example
@@ -70,6 +115,24 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
70
115
filter = _.contains(" (extension)" )
71
116
)
72
117
118
+ @ Test def `filter-by-type-subtype-old` =
119
+ check(
120
+ """ |package example
121
+ |
122
+ |class A
123
+ |class B extends A
124
+ |
125
+ |object enrichments:
126
+ | implicit class Test(a: A):
127
+ | def doSomething: A = a
128
+ |
129
+ |def main = (new B).do@@
130
+ |""" .stripMargin,
131
+ """ |doSomething: A (implicit)
132
+ |""" .stripMargin,
133
+ filter = _.contains(" (implicit)" )
134
+ )
135
+
73
136
@ Test def `simple-edit` =
74
137
checkEdit(
75
138
""" |package example
@@ -92,6 +155,28 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
92
155
|""" .stripMargin
93
156
)
94
157
158
+ @ Test def `simple-edit-old` =
159
+ checkEdit(
160
+ """ |package example
161
+ |
162
+ |object enrichments:
163
+ | implicit class A (num: Int):
164
+ | def incr: Int = num + 1
165
+ |
166
+ |def main = 100.inc@@
167
+ |""" .stripMargin,
168
+ """ |package example
169
+ |
170
+ |import example.enrichments.A
171
+ |
172
+ |object enrichments:
173
+ | implicit class A (num: Int):
174
+ | def incr: Int = num + 1
175
+ |
176
+ |def main = 100.incr
177
+ |""" .stripMargin
178
+ )
179
+
95
180
@ Test def `simple-edit-suffix` =
96
181
checkEdit(
97
182
""" |package example
@@ -114,6 +199,28 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
114
199
|""" .stripMargin
115
200
)
116
201
202
+ @ Test def `simple-edit-suffix-old` =
203
+ checkEdit(
204
+ """ |package example
205
+ |
206
+ |object enrichments:
207
+ | implicit class A (val num: Int):
208
+ | def plus(other: Int): Int = num + other
209
+ |
210
+ |def main = 100.pl@@
211
+ |""" .stripMargin,
212
+ """ |package example
213
+ |
214
+ |import example.enrichments.A
215
+ |
216
+ |object enrichments:
217
+ | implicit class A (val num: Int):
218
+ | def plus(other: Int): Int = num + other
219
+ |
220
+ |def main = 100.plus($0)
221
+ |""" .stripMargin
222
+ )
223
+
117
224
@ Test def `simple-empty` =
118
225
check(
119
226
""" |package example
@@ -129,6 +236,21 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
129
236
filter = _.contains(" (extension)" )
130
237
)
131
238
239
+ @ Test def `simple-empty-old` =
240
+ check(
241
+ """ |package example
242
+ |
243
+ |object enrichments:
244
+ | implicit class TestOps(a: Int):
245
+ | def testOps(b: Int): String = ???
246
+ |
247
+ |def main = 100.@@
248
+ |""" .stripMargin,
249
+ """ |testOps(b: Int): String (implicit)
250
+ |""" .stripMargin,
251
+ filter = _.contains(" (implicit)" )
252
+ )
253
+
132
254
@ Test def `directly-in-pkg1` =
133
255
check(
134
256
""" |
@@ -143,6 +265,20 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
143
265
|""" .stripMargin
144
266
)
145
267
268
+ @ Test def `directly-in-pkg1-old` =
269
+ check(
270
+ """ |
271
+ |package examples:
272
+ | implicit class A(num: Int):
273
+ | def incr: Int = num + 1
274
+ |
275
+ |package examples2:
276
+ | def main = 100.inc@@
277
+ |""" .stripMargin,
278
+ """ |incr: Int (implicit)
279
+ |""" .stripMargin
280
+ )
281
+
146
282
@ Test def `directly-in-pkg2` =
147
283
check(
148
284
""" |package example:
@@ -157,6 +293,20 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
157
293
|""" .stripMargin
158
294
)
159
295
296
+ @ Test def `directly-in-pkg2-old` =
297
+ check(
298
+ """ |package examples:
299
+ | object X:
300
+ | def fooBar(num: Int) = num + 1
301
+ | implicit class A (num: Int) { def incr: Int = num + 1 }
302
+ |
303
+ |package examples2:
304
+ | def main = 100.inc@@
305
+ |""" .stripMargin,
306
+ """ |incr: Int (implicit)
307
+ |""" .stripMargin
308
+ )
309
+
160
310
@ Test def `nested-pkg` =
161
311
check(
162
312
""" |package a: // some comment
@@ -175,7 +325,25 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
175
325
|""" .stripMargin
176
326
)
177
327
178
- @ Test def `name-conflict` =
328
+ @ Test def `nested-pkg-old` =
329
+ check(
330
+ """ |package aa: // some comment
331
+ | package cc:
332
+ | implicit class A (num: Int):
333
+ | def increment2 = num + 2
334
+ | implicit class A (num: Int):
335
+ | def increment = num + 1
336
+ |
337
+ |
338
+ |package bb:
339
+ | def main: Unit = 123.incre@@
340
+ |""" .stripMargin,
341
+ """ |increment: Int (implicit)
342
+ |increment2: Int (implicit)
343
+ |""" .stripMargin
344
+ )
345
+
346
+ @ Test def `name-conflict` =
179
347
checkEdit(
180
348
"""
181
349
|package example
0 commit comments