File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,15 @@ class Completions(
7474 case tpe :: (appl : AppliedTypeTree ) :: _ if appl.tpt == tpe => false
7575 case sel :: (funSel @ Select (fun, name)) :: (appl : GenericApply ) :: _
7676 if appl.fun == funSel && sel == fun => false
77- case _ => true )
77+ case _ => true ) &&
78+ (adjustedPath match
79+ /* In case of `class X derives TC@@` we shouldn't add `[]`
80+ */
81+ case Ident (_) :: (templ : untpd.DerivingTemplate ) :: _ =>
82+ val pos = completionPos.toSourcePosition
83+ ! templ.derived.exists(_.sourcePos.contains(pos))
84+ case _ => true
85+ )
7886
7987 private lazy val isNew : Boolean = Completion .isInNewContext(adjustedPath)
8088
Original file line number Diff line number Diff line change @@ -2238,3 +2238,11 @@ class CompletionSuite extends BaseCompletionSuite:
22382238 |""" .stripMargin,
22392239 " asTerm: Term"
22402240 )
2241+
2242+ @ Test def `derives-no-square-brackets` =
2243+ check(
2244+ """
2245+ |case class Miau(y: Int) derives Ordering, CanEqu@@
2246+ |""" .stripMargin,
2247+ " CanEqual scala"
2248+ )
You can’t perform that action at this time.
0 commit comments