Skip to content

False positive unused given in extensions when referring to type alias #23250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
WojciechMazur opened this issue May 23, 2025 · 0 comments · May be fixed by #23256
Open

False positive unused given in extensions when referring to type alias #23250

WojciechMazur opened this issue May 23, 2025 · 0 comments · May be fixed by #23256
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

Similar to #23125 but this one still fails in main

Compiler version

Last good release: 3.7.0-RC1-bin-20250118-b801042-NIGHTLY
First bad release: 3.7.0-RC1-bin-20250227-1b0be01-NIGHTLY
Affects 3.7.0, 3.7.1-RC2
Bisect points to c65d45d

Minimized code

//> using options -Wunused:all -Werror

trait MonadError[F[_], E]
type MonadThrow[F[_]] = MonadError[F, Throwable]

trait MetaStreams[F[_]]:
  def use[A]: F[A] = ???
trait WriteResult

trait MetaStreamsSyntax:
  extension [F[_]](ms: MetaStreams[F])(using MonadThrow[F])
    def setMaxAge(): F[WriteResult] = 
      summon[MonadThrow[F]]
      ms.use[WriteResult]

    def setTruncateBefore(): F[WriteResult] =
      ms.use[WriteResult]

Output

[error] ./test.scala:13:46
[error] unused implicit parameter
[error]   extension [F[_]](ms: MetaStreams[F])(using MonadThrow[F])
[error]                                              ^

Expectation

Should not report unused MonadThrow

@WojciechMazur WojciechMazur added itype:bug regression This worked in a previous version but doesn't anymore area:linting Linting warnings enabled with -W or -Xlint labels May 23, 2025
@som-snytt som-snytt self-assigned this May 23, 2025
@som-snytt som-snytt linked a pull request May 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants