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

Surface.methodsOf: opaque type params confusion => Objc[Any] recognized as Objc[Any][Any] #2753

Open
wiltonlazary opened this issue Feb 13, 2023 · 1 comment · May be fixed by #3319
Open

Comments

@wiltonlazary
Copy link

/* 
  Found:    laz.core.lang.codec.model.Objc[Any][Any]
  Required: laz.core.lang.codec.model.Objc[Any]
*/

//
opaque type Objc[A] <: Map[String, A] =
  Map[String, A]

extension [A](self: Objc[A])
  @targetName("asMap$Objc")
  implicit inline def asMap: Map[String, A] =
    self

extension [A](self: Map[String, A])
  @targetName("asObjc$Map")
  implicit inline def asObjc: Objc[A] =
    self

object Objc {
  inline def empty[A]: Objc[A] =
    Map.empty[String, A]

  inline def apply[A](elems: (String, A)*): Objc[A] =
    Map[String, A](elems: _*)
}      
//

class ModelCodecSpec extends munit.FunSuite:
  test("ObjcTest") {
    class Local0 {
      var $$related: Objc[Any] = Objc.empty
      def related: Objc[Any] = $$related
      def related_=(x: Objc[Any]): Unit = { $$related = x }
    }

    val x1 = Surface.of[Local0]
    val x2 = Surface.methodsOf[Local0]
  }
@xerial xerial added this to the Airframe 23 milestone Jun 16, 2023
@xerial
Copy link
Member

xerial commented Dec 23, 2023

@wiltonlazary Thanks for the detailed example. I could reproduce this issue on my end, and Surface now supports opaque type #3318, I'll take a look.

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.

2 participants