Skip to content

Conversation

OndrejSpanel
Copy link
Contributor

This an exploratory PR for #3433 and #3429

I would like to know where exactly is the type mismatch happening and if perhaps there is a way to avoid it completely, even at cost of reported method surfaces being not 100% accurate.

@OndrejSpanel
Copy link
Contributor Author

OndrejSpanel commented Mar 2, 2024

Logging says:

wvlet.airframe.surface.ClassMethodSurface.apply(1, __s000, "compare", wvlet.airframe.surface.Primitive.Int, wvlet.airframe.surface.StaticMethodParameter.apply(method = wvlet.airframe.surface.MethodRef.apply(owner = classOf[wvlet.airframe.surface.i3439.OuterType.InnerType], name = "compare", paramTypes = classOf[Base.this.InnerType], isConstructor = false), index = 0, name = "that", isRequired = false, isSecret = false, surface = __s001, defaultValue = scala.None, accessor = scala.None, methodArgAccessor = scala.None).toIndexedSeq, scala.Some.apply[scala.Function2[scala.Any, scala.collection.immutable.Seq[scala.Any], scala.Any]](((x: scala.Any, argsΓéâ: scala.collection.immutable.Seq[scala.Any]) => x.asInstanceOf[wvlet.airframe.surface.i3439.OuterType.InnerType].compare(argsΓéâ.apply(0).asInstanceOf[Base.this.InnerType]))))

Notice last part: x.asInstanceOf[wvlet.airframe.surface.i3439.OuterType.InnerType].compare(argsΓéâ.apply(0).asInstanceOf[Base.this.InnerType]))))

Method compare is called, but the argument is of a wrong type. This seems to be a methodCaller field. It is a pity to get a mismatch here, because the external signature is (Any, Seq[Any]) => Any.

When I disable methodCaller creation by replacing it with '{ Option.empty[(Any, Seq[Any]) => Any] }, I get a compiler exception someplace else:

exception while retyping Base.this of class This # -1
java.lang.AssertionError: assertion failed: missing outer accessor in object i3439

@OndrejSpanel
Copy link
Contributor Author

I have decided not to explore this any more. For my purposes I do not need the objectFactory or methodCaller functionality, therefore I decided to create a fork of the library instead without this functionality. The fork has no other ambition than to serve as a temporary workaround until the issues are fixed here.

If anyone is interested, the fork can be found at https://github.com/OpenGrabeso/light-surface. I intend to publish the artifacts in GitHub Packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant