File tree 2 files changed +31
-0
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/edit
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -506,6 +506,8 @@ object OverrideCompletions:
506
506
defn match
507
507
case td : TypeDef if text.charAt(td.rhs.span.end) == ':' =>
508
508
Some (td.rhs.span.end)
509
+ case TypeDef (_, temp : Template ) =>
510
+ temp.parentsOrDerived.lastOption.map(_.span.end).filter(text.charAt(_) == ':' )
509
511
case _ => None
510
512
511
513
private def fallbackFromParent (parent : Tree , name : String )(using Context ) =
Original file line number Diff line number Diff line change @@ -1272,6 +1272,35 @@ class AutoImplementAbstractMembersSuite extends BaseCodeActionSuite:
1272
1272
|""" .stripMargin,
1273
1273
)
1274
1274
1275
+ @ Test def `braceless-case-class` =
1276
+ checkEdit(
1277
+ """ |package a
1278
+ |
1279
+ |trait Base:
1280
+ | def foo(x: Int): Int
1281
+ | def bar(x: String): String
1282
+ |
1283
+ |case class <<Concrete>>() extends Base:
1284
+ | def aaa = "aaa"
1285
+ |end Concrete
1286
+ |""" .stripMargin,
1287
+ """ |package a
1288
+ |
1289
+ |trait Base:
1290
+ | def foo(x: Int): Int
1291
+ | def bar(x: String): String
1292
+ |
1293
+ |case class Concrete() extends Base:
1294
+ |
1295
+ | override def bar(x: String): String = ???
1296
+ |
1297
+ | override def foo(x: Int): Int = ???
1298
+ |
1299
+ | def aaa = "aaa"
1300
+ |end Concrete
1301
+ |""" .stripMargin
1302
+ )
1303
+
1275
1304
def checkEdit (
1276
1305
original : String ,
1277
1306
expected : String
You can’t perform that action at this time.
0 commit comments