Skip to content

Commit e9cd9a5

Browse files
authored
chore: Fix nightlies after recent changes (#4312)
The issues caused by scala/scala3#15877
1 parent d719b40 commit e9cd9a5

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

mtags/src/main/scala-3/scala/meta/internal/pc/MetalsInteractive.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,14 @@ object MetalsInteractive:
248248
target.sourcePos.contains(pos) =>
249249
List((target.symbol, target.typeOpt))
250250

251-
case path @ head :: tl =>
251+
case path @ head :: tail =>
252252
if head.symbol.is(Synthetic) then
253-
enclosingSymbolsWithExpressionType(tl, pos, indexed, skipCheckOnName)
253+
enclosingSymbolsWithExpressionType(
254+
tail,
255+
pos,
256+
indexed,
257+
skipCheckOnName,
258+
)
254259
else if head.symbol != NoSymbol then
255260
if skipCheckOnName ||
256261
MetalsInteractive.isOnName(
@@ -259,12 +264,18 @@ object MetalsInteractive:
259264
indexed.ctx.source,
260265
)
261266
then List((head.symbol, head.typeOpt))
267+
/* Type tree for List(1) has an Int type variable, which has span
268+
* but doesn't exist in code.
269+
* https://github.com/lampepfl/dotty/issues/15937
270+
*/
271+
else if head.isInstanceOf[TypeTree] then
272+
enclosingSymbolsWithExpressionType(tail, pos, indexed)
262273
else Nil
263274
else
264275
val recovered = recoverError(head, indexed)
265276
if recovered.isEmpty then
266277
enclosingSymbolsWithExpressionType(
267-
tl,
278+
tail,
268279
pos,
269280
indexed,
270281
skipCheckOnName,

tests/cross/src/test/scala/tests/pc/CompletionKeywordSuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
290290
|""".stripMargin,
291291
"""|return
292292
|""".stripMargin,
293+
// methods add in 3.2.1
294+
filter = item => !item.contains("retains"),
293295
)
294296

295297
check(
@@ -302,6 +304,8 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
302304
|}
303305
|""".stripMargin,
304306
"",
307+
// methods add in 3.2.1
308+
filter = item => !item.contains("retains"),
305309
)
306310

307311
check(
@@ -319,6 +323,8 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
319323
compat = Map(
320324
"3" -> ""
321325
),
326+
// methods add in 3.2.1
327+
filter = item => !item.contains("retains"),
322328
)
323329

324330
check(
@@ -329,6 +335,8 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
329335
|ret@@
330336
|""".stripMargin,
331337
"",
338+
// methods add in 3.2.1
339+
filter = item => !item.contains("retains"),
332340
)
333341

334342
check(

0 commit comments

Comments
 (0)