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

Inlining issue for named tuples hidden behind opaque types #22324

Open
hamzaremmal opened this issue Jan 8, 2025 · 1 comment
Open

Inlining issue for named tuples hidden behind opaque types #22324

hamzaremmal opened this issue Jan 8, 2025 · 1 comment
Labels

Comments

@hamzaremmal
Copy link
Member

hamzaremmal commented Jan 8, 2025

Compiler version

3.6.2

Minimized code

//> using scala 3.6.2
//> using options -experimental

import scala.language.experimental.namedTuples

opaque type System = (wires: Any)

extension (system: System)
  inline def foo = system.wires
end extension

val simulation: System = ???
val _ = simulation.foo

Output

-- Error: solution.scala:12:19 -------------------------------------------------
 12 |val _ = simulation.foo
    |        ^^^^^^^^^^^^^^
    |undefined: tup.productElement # -1: TermRef(TermRef(NoPrefix,val tup),productElement) at inlining
    |---------------------------------------------------------------------------
    |Inline stack trace
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from NamedTuple.scala:144
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from NamedTuple.scala:144
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from NamedTuple.scala:144
  9 |  inline def foo = system.wires
    |                   ^^^^^^^^^^^^
     ---------------------------------------------------------------------------
1 error found

Expectation

Compiles without any issue

Notes

  • The soft keyword opaque in System is important to reproduce the issue
  • The soft keyword inline in foo is important to reproduce the issue
@EugeneFlesselle
Copy link
Contributor

Potentially related to #14653, #20427

@hamzaremmal hamzaremmal changed the title Inlining issue for named tuples hidden behing opaque types Inlining issue for named tuples hidden behind opaque types Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants