Skip to content
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

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

Closed
WojciechMazur opened this issue Sep 6, 2022 · 1 comment · Fixed by #16086
Closed

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

WojciechMazur opened this issue Sep 6, 2022 · 1 comment · Fixed by #16086
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc good first issue Perfect for someone who wants to get started contributing itype:bug Spree Suitable for a future Spree
Milestone

Comments

@WojciechMazur
Copy link
Contributor

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

@WojciechMazur WojciechMazur added itype:bug stat:needs spec stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 6, 2022
@odersky
Copy link
Contributor

odersky commented Sep 7, 2022

I think that's related to a change that @dwijnand made. I believe the warning is correct in this case. But it would be nice if there was a reason given, i.e.

./test.scala:5:46: the type test for PosInt cannot be checked at runtime because PosInt is a local class`.

@odersky odersky removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Sep 7, 2022
@mbovel mbovel added the area:reporting Error reporting including formatting, implicit suggestions, etc label Sep 9, 2022
@dwijnand dwijnand added Spree Suitable for a future Spree good first issue Perfect for someone who wants to get started contributing and removed stat:needs spec labels Sep 9, 2022
@dwijnand dwijnand linked a pull request Sep 21, 2022 that will close this issue
@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc good first issue Perfect for someone who wants to get started contributing itype:bug Spree Suitable for a future Spree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants