@@ -1001,7 +1001,7 @@ class CompletionTest {
1001
1001
)
1002
1002
code """ import scala.concurrent.Future
1003
1003
|class Foo(x: Fut ${m1}) """ .withSource
1004
- .completion(m1, expected)
1004
+ .completion(m1, expected)
1005
1005
}
1006
1006
1007
1007
@ Test def completeTemplateParents : Unit = {
@@ -1011,7 +1011,7 @@ class CompletionTest {
1011
1011
)
1012
1012
code """ import scala.concurrent.Future
1013
1013
|class Foo extends Futu ${m1}""" .withSource
1014
- .completion(m1, expected)
1014
+ .completion(m1, expected)
1015
1015
}
1016
1016
1017
1017
@ Test def completeTemplateSelfType : Unit = {
@@ -1021,7 +1021,7 @@ class CompletionTest {
1021
1021
)
1022
1022
code """ import scala.concurrent.Future
1023
1023
|class Foo[A]{ self: Futu ${m1} => } """ .withSource
1024
- .completion(m1, expected)
1024
+ .completion(m1, expected)
1025
1025
}
1026
1026
1027
1027
@ Test def backticks : Unit = {
@@ -1061,7 +1061,7 @@ class CompletionTest {
1061
1061
| enum Bar:
1062
1062
| case `back-tick`
1063
1063
| case `match`
1064
- |
1064
+ |
1065
1065
| val x = Bar. ${m1}"""
1066
1066
.withSource.completion(m1, expected)
1067
1067
}
@@ -1074,7 +1074,7 @@ class CompletionTest {
1074
1074
| enum Bar:
1075
1075
| case `back-tick`
1076
1076
| case `match`
1077
- |
1077
+ |
1078
1078
| val x = Bar.`back ${m1}"""
1079
1079
.withSource.completion(m1, expected)
1080
1080
}
@@ -1086,7 +1086,7 @@ class CompletionTest {
1086
1086
code """ object Foo:
1087
1087
| enum Bar:
1088
1088
| case `has space`
1089
- |
1089
+ |
1090
1090
| val x = Bar.`has s ${m1}"""
1091
1091
.withSource.completion(m1, expected)
1092
1092
}
@@ -1102,7 +1102,7 @@ class CompletionTest {
1102
1102
| val foo = 1
1103
1103
| val `foo-bar` = 2
1104
1104
| val `bar` = 3
1105
- |
1105
+ |
1106
1106
| val x = Bar.fo ${m1}"""
1107
1107
.withSource.completion(m1, expected)
1108
1108
}
@@ -1117,7 +1117,7 @@ class CompletionTest {
1117
1117
| object Bar:
1118
1118
| val foo = 1
1119
1119
| val `foo-bar` = 2
1120
- |
1120
+ |
1121
1121
| val x = Bar.`fo ${m1}"""
1122
1122
.withSource.completion(m1, expected)
1123
1123
}
@@ -1146,7 +1146,7 @@ class CompletionTest {
1146
1146
| case x: Int => Foo(x)
1147
1147
| case x: Any => x
1148
1148
|}
1149
- |object Test:
1149
+ |object Test:
1150
1150
| elem(1).foo ${m1}"""
1151
1151
.withSource.completion(m1, expected)
1152
1152
}
@@ -1183,27 +1183,61 @@ class CompletionTest {
1183
1183
.withSource.completion(m1, expected)
1184
1184
}
1185
1185
1186
- // This test is not passing due to https://github.com/lampepfl/dotty/issues/14687
1187
- // @Test def higherKindedMatchTypeImplicitConversionCompletion: Unit = {
1188
- // val expected = Set(
1189
- // ("mapBoo", Method, "[B](op: Int => B): Boo[B]"),
1190
- // ("mapFoo", Method, "[B](op: Int => B): Foo[B]"),
1191
- // )
1192
- // code"""import scala.language.implicitConversions
1193
- // |case class Foo[A](x: A) {
1194
- // | def mapFoo[B](op: A => B): Foo[B] = ???
1195
- // |}
1196
- // |case class Boo[A](x: A) {
1197
- // | def mapBoo[B](op: A => B): Boo[B] = ???
1198
- // |}
1199
- // |type M[A] = A match {
1200
- // | case Int => Foo[Int]
1201
- // |}
1202
- // |implicit def fooToBoo[A](x: Foo[A]): Boo[A] = Boo(x.x)
1203
- // |case class Bar[F[_]](bar: F[Int])
1204
- // |def foo(x: Bar[M]) = x.bar.m${m1}"""
1205
- // .withSource.completion(m1, expected)
1206
- // }
1186
+ @ Test def higherKindedMatchTypeImplicitConversionCompletion : Unit = {
1187
+ val expected = Set (
1188
+ (" mapBoo" , Method , " [B](op: Int => B): Boo[B]" ),
1189
+ (" mapFoo" , Method , " [B](op: Int => B): Foo[B]" ),
1190
+ )
1191
+ code """ import scala.language.implicitConversions
1192
+ |case class Foo[A](x: A) {
1193
+ | def mapFoo[B](op: A => B): Foo[B] = ???
1194
+ |}
1195
+ |case class Boo[A](x: A) {
1196
+ | def mapBoo[B](op: A => B): Boo[B] = ???
1197
+ |}
1198
+ |type M[A] = A match {
1199
+ | case Int => Foo[Int]
1200
+ |}
1201
+ |implicit def fooToBoo[A](x: Foo[A]): Boo[A] = Boo(x.x)
1202
+ |case class Bar[F[_]](bar: F[Int])
1203
+ |def foo(x: Bar[M]) = x.bar.m ${m1}"""
1204
+ .withSource.completion(m1, expected)
1205
+ }
1206
+
1207
+ @ Test def higherKindedTypeInferenceTest : Unit = {
1208
+ val expected = Set (
1209
+ (" fooTest" , Method , " (x: Int): String" ),
1210
+ )
1211
+ code """ class Test[A, B] {
1212
+ | def fooTest(x: A): B = ???
1213
+ |}
1214
+ |
1215
+ |object M:
1216
+ | val test = new Test[Int, String] {}
1217
+ | test.foo ${m1}
1218
+ | (new Test[Int, String] {}).foo ${m2}""" .withSource
1219
+ .completion(m1, expected)
1220
+ .completion(m2, expected)
1221
+ }
1222
+
1223
+ @ Test def higherKindedImplicitConversionsCompletions : Unit = {
1224
+ val expected = Set (
1225
+ (" mapBoo" , Method , " [B](f: Int => B): Boo[B]" ),
1226
+ (" mapFoo" , Method , " [B](f: Int => B): Foo[B]" ),
1227
+ )
1228
+ code """ import scala.language.implicitConversions
1229
+ |case class Foo[A](x: A) {
1230
+ | def mapFoo[B](f: A => B): Foo[B] = ???
1231
+ |}
1232
+ |case class Boo[C](x: C) {
1233
+ | def mapBoo[B](f: C => B): Boo[B] = ???
1234
+ }
1235
+ |implicit def fooToBoo[D](x: Foo[D]): Boo[D] = Boo(x.x)
1236
+ |object Test:
1237
+ | val x = Foo(1)
1238
+ | x.ma ${m1}"""
1239
+ .withSource.completion(m1, expected)
1240
+ }
1207
1241
1208
1242
@ Test def higherKindedMatchTypeExtensionMethodCompletion : Unit = {
1209
1243
val expected = Set (
0 commit comments