scala3
scala3 copied to clipboard
Typer regression in `eed3si9n/jarjar-abrams` for shadowed variable of different type
Based on failure in OpenCB for:
- eed3si9n/jarjar-abrams - build logs
- sbt/io - build logs
Found in : java.io.InputStream is a correct input type, however existance of shadowed in: java.nio.Path in the scope breaks the compilation
Compiler version
Last good release: 3.8.0-RC1-bin-20251103-714f3b6-NIGHTLY First bad release: 3.8.0-RC1-bin-20251104-b83b3d9-NIGHTLY
Bisect points to one of: f3aea49b6f7754ffa79beab007fcdac4a37dc4c5 5b03dca156e523a20ca232d9c03dc8d53dd4588e Both are commits from #24231
Not present in 3.8.0-RCs, merged after 3.8.0 cutoff, but before change of build developed version
Minimized code
import java.io.*
import java.nio.file.*
abstract class Using[Source, A]:
def apply[R](src: Source)(f: A => R): R = ???
object Using:
val fileInputStream: Using[Path, InputStream] = ???
def transfer(in: Path, out: OutputStream): Unit =
Using.fileInputStream(in)(in => transfer(in, out))
def transfer(in: InputStream, out: OutputStream): Unit = ???
Output
-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/community-build3/test.scala:12:43
12 | Using.fileInputStream(in)(in => transfer(in, out))
| ^^
| Found: (in : java.io.InputStream)
| Required: java.nio.file.Path
|
| longer explanation available when compiling with `-explain`
Expectation
Should continue to compile