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(
74
74
case tpe :: (appl : AppliedTypeTree ) :: _ if appl.tpt == tpe => false
75
75
case sel :: (funSel @ Select (fun, name)) :: (appl : GenericApply ) :: _
76
76
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
+ )
78
86
79
87
private lazy val isNew : Boolean = Completion .isInNewContext(adjustedPath)
80
88
Original file line number Diff line number Diff line change @@ -2238,3 +2238,11 @@ class CompletionSuite extends BaseCompletionSuite:
2238
2238
|""" .stripMargin,
2239
2239
" asTerm: Term"
2240
2240
)
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