Skip to content

3.7 regression - false negative warning: unused imports #22690

Closed
@OndrejSpanel

Description

@OndrejSpanel

I have tested 3.6.4 briefly against my project and to my dismay I have the sad duty to report a regression here. The code compiles without any warnings in 3.6.3.

I was not able to find a repro without external dependency yet, I guess some macros are needed for the issue to happen.

Compiler version

3.6.4-RC1, 3.6.4-RC2

Minimized code

import io.bullet.borer.*
import io.bullet.borer.derivation.MapBasedCodecs.*
import Settings.*

object Settings:
  given codec: Codec[Settings] = deriveCodec
  def x = 0

case class Settings(value: Double = x)

build.sbt:

scalaVersion := "3.6.4-RC1"

name := "Sandbox"

libraryDependencies += "io.bullet" %% "borer-core" % "1.15.0"
libraryDependencies += "io.bullet" %% "borer-derivation" % "1.15.0"

scalacOptions ++= Seq("-Xfatal-warnings", "-Wunused:imports")

Result

C:\Dev\Sandbox\src\main\scala\Settings.scala:3:17
unused import
import Settings.*

Image

Expectation

The import is not unused, in fact the code does not compile without the import.

Repro

Scastie link to repro: https://scastie.scala-lang.org/OndrejSpanel/bHJcv9AhSS2DODsdcQFvAw/5

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions