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

class cast exception with inline defs in nested objects #15317

Closed
rmgk opened this issue May 30, 2022 · 0 comments · Fixed by #15327
Closed

class cast exception with inline defs in nested objects #15317

rmgk opened this issue May 30, 2022 · 0 comments · Fixed by #15327

Comments

@rmgk
Copy link

rmgk commented May 30, 2022

Compiler version

3.1.2, 3.2.0-RC1-bin-20220528-23c0825-NIGHTLY

Minimized code

class Outer {
  val outer = 1
  object Inner {
    def forwarder: Int   = inlined
    inline def inlined: Int = outer
  }
}

@main def run() = (new Outer).Inner.forwarder

Output

Exception in thread "main" java.lang.ClassCastException: class Outer$Inner$ cannot be cast to class Outer (Outer$Inner$ and Outer are in unnamed module of loader java.net.URLClassLoader @36e409e0)
	at Outer$Inner$.forwarder(bits.scala:4)
	at bits$package$.run(bits.scala:10)
	at run.main(bits.scala:10)

Expectation

Runs without exception.

@rmgk rmgk added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2022
@szymon-rd szymon-rd added area:inline and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2022
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants