File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/edit Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -506,6 +506,8 @@ object OverrideCompletions:
506506 defn match
507507 case td : TypeDef if text.charAt(td.rhs.span.end) == ':' =>
508508 Some (td.rhs.span.end)
509+ case TypeDef (_, temp : Template ) =>
510+ temp.parentsOrDerived.lastOption.map(_.span.end).filter(text.charAt(_) == ':' )
509511 case _ => None
510512
511513 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:
12721272 |""" .stripMargin,
12731273 )
12741274
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+
12751304 def checkEdit (
12761305 original : String ,
12771306 expected : String
You can’t perform that action at this time.
0 commit comments