Skip to content

spurious unused warning of local given for CanEqual with -Wunused:locals and -language:strictEquality #17762

Closed
@felher

Description

@felher

3.3 is awesome, thank you for bringing warnings back and all your hard work! ❤️
There seems to be a small interaction problem with what is regarded unused and -language:strictEquality though:

Compiler version

3.3.0

Minimized code

CompilerOptions:

  • -language:strictEquality
  • -Wunused:locals
class SomeType

def testIt(st1: SomeType, st2: SomeType): Boolean =
  given CanEqual[SomeType, SomeType] = CanEqual.derived
  st1 == st2

Output

A warning that the given definition is unused - or a compiler error that SomeType can not be compare with itself when removed

Expectation

It should not warn since the given CanEqual[...] is required by the compiler under -language:strictEquality

Scastie

https://scastie.scala-lang.org/i6Osmdc1SSK9FQlN3a65dA

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