Skip to content

false not used #12701

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

Closed
shestero opened this issue Dec 9, 2022 · 3 comments
Closed

false not used #12701

shestero opened this issue Dec 9, 2022 · 3 comments

Comments

@shestero
Copy link

shestero commented Dec 9, 2022

Reproduction steps

Scala version: 2.13.10 (also checked 2.13.8)

    def pairOriginTarget[T](f: String => Future[T]): Future[List[T]] = Future.sequence(List(req.srcCaseId, req.targetCaseId).map(f))
    for {
      cases @ List(_, target)                    <- pairOriginTarget(gettingCase)
      List(originInstance, targetInstance)       = cases.map(_.caseInstance)
      List(originParts, targetParts)             <- pairOriginTarget(gettingParts)
      ...
    def pairOriginTarget[T](f: String => Future[T]): Future[List[T]] = Future.sequence(List(req.srcCaseId, req.targetCaseId).map(f))
    for {
      cases @ List(_, target)                    <- pairOriginTarget(gettingCase)
      List(originParts, targetParts)             <- pairOriginTarget(gettingParts)
      List(originInstance, targetInstance)       = cases.map(_.caseInstance)
      ...

Problem

The first peace of code produce false compiler message:
pattern var cases in value $anonfun is never used: use a wildcard _ or suppress this warning with cases@_
cases @ List(_, target) <- pairOriginTarget(caseStaticService.getCaseWithPrinting)
The second compiles ok.
I suggest some optimization is to blame.

@som-snytt
Copy link

Just the desugaring of for is too complex for the linter. There is an existing ticket.

@SethTisue
Copy link
Member

is it #10287 or is that distinct? (local val vs pattern var)

@som-snytt
Copy link

som-snytt commented Dec 9, 2022

That is the duplicatee.

@SethTisue SethTisue closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants