-
Notifications
You must be signed in to change notification settings - Fork 1.1k
undefined: ...proxy...
errors when inlining opaque types
#22359
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
Comments
Splitting the owners for the opaque types in the minimisation gives us a slightly different error (also incorrect): object Obj2:
opaque type NT[N <: Tuple, V <: Tuple] = V
extension [N <: Tuple, V <: Tuple] (x: NT[N, V]) {
inline def apply(n: Int): Any =
x.productElement(n)
}
object Obj:
opaque type System = Obj2.NT[Tuple1["wires"], Tuple1[Any]]
extension (system: System) {
inline def foo = system.apply(0)
}
import Obj._
val simulation: System = ???
val _ = simulation.foo
We can see that slightly incorrect bindings are generated: val $proxy1:
Obj.type{type System = Obj2.NT[Tuple1[("wires" : String)], Tuple1[Any]]}
=
Obj.$asInstanceOf[
Obj.type{
type System = Obj2.NT[Tuple1[("wires" : String)], Tuple1[Any]]}
]
val system$proxy1: (simulation : Obj.System) & $proxy1.System =
simulation.$asInstanceOf[(simulation : Obj.System) & $proxy1.System]
system$proxy1.productElement(0):Any:Any with a reference to Obj.NT, which is an opaque type, for which proxies are not generated. I imagine it should generate something like this: val $proxy0: Obj2.type{type NT[N <: Tuple, V <: Tuple] = V} = Obj2.asInstanceOf[Obj2.type{type NT[N <: Tuple, V <: Tuple] = V}]
val $proxy1:
Obj.type{type System = $proxy0.NT[Tuple1[("wires" : String)], Tuple1[Any]]}
=
Obj.$asInstanceOf[
Obj.type{
type System = $proxy0.NT[Tuple1[("wires" : String)], Tuple1[Any]]}
]
val system$proxy1: (simulation : Obj.System) & $proxy1.System =
simulation.$asInstanceOf[(simulation : Obj.System) & $proxy1.System]
system$proxy1.productElement(0):Any:Any |
tgodzik
pushed a commit
to scala/scala3-lts
that referenced
this issue
Apr 1, 2025
… types (scala#22381) Fixes scala#22359 Fixes scala#17243 [Cherry-picked fe2e6e9]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
main
Minimized code
Output
Expectation
no error
notes
Initially submitted in connection to NamedTuples: #22324 (fixed for NamedTuples only)
The text was updated successfully, but these errors were encountered: