scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.1k stars 334 forks source link

inlining fails with "following variables are shadowed" #6924

Open scarf005 opened 2 weeks ago

scarf005 commented 2 weeks ago

Describe the bug

Scala code runner version: 1.4.3 Scala version (default): 3.5.2

  1. write following code:
    
    package `2015`.day24

def quantumEntanglement(xs: Iterable[Long]): Long = xs.product

@main def main() = val input = Vector(1L, 2L) val groupWeight = input.sum / 3

val answer = (1 to input.size).iterator .map { n => val combs = input.combinations(n).filter(_.sum == groupWeight).toVector combs }

println(answer)

2. attempt to inline `combs`.

### Expected behavior

```diff
    .map { n =>
-      val combs = input.combinations(n).filter(_.sum == groupWeight).toVector
-      combs
+      input.combinations(n).filter(_.sum == groupWeight).toVector
    }

code inlining is done without issue.

Actual behavior

however, inlining fails with:

Following variables are shadowed: scala.Long.==.

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.42.0

Extra context or search terms

reports.zip

tgodzik commented 2 weeks ago

Thanks for reporting! I will try and take a look later next week