Skip to content

Type test for local class cannot be checked at runtime in 3.2.1-RC1 #15981

Closed
@WojciechMazur

Description

@WojciechMazur

Regression reproduced based on Open CB #4730 found in fd4s/vulcan
Part of the #15949 regression tracker

I'm not sure if it's a regression or an improvement. Code, where the error was reported, has not changed recently, so probably these warnings should be checked

Compiler version

Produces warning in 3.2.1-RC1
No warnings in 3.2.0

Minimized code

//> using options "-Xfatal-warnings"

val _ = locally{
  sealed abstract class PosInt(val value: Int) {
    override def equals(any: Any): Boolean = any.isInstanceOf[PosInt]
  }
}

Output

Compiling project (Scala 3.2.1-RC1, JVM)
[error] ./test.scala:5:46: the type test for PosInt cannot be checked at runtime
[error]     override def equals(any: Any): Boolean = any.isInstanceOf[PosInt]
[error]    

Expectation

Should compile

Metadata

Metadata

Assignees

Labels

SpreeSuitable for a future Spreearea:reportingError reporting including formatting, implicit suggestions, etcgood first issuePerfect for someone who wants to get started contributingitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions