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

Add support for clauseInterleaving in JVM generic signatures #21709

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

hamzaremmal
Copy link
Member

Closes #21346

// erased method parameters do not make it to the bytecode.
def effectiveParamInfoss(t: Type)(using Context): List[List[Type]] = t match {
case t: MethodType if t.hasErasedParams =>
t.paramInfos.zip(t.erasedParams).collect{ case (i, false) => i }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the previous code here didn't just use filter

// scalajs: --skip

object Foo:
def foo[X, Y, Z](x: X, y: Y)[A](z: Z) = ???
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test what happens if we actually refer to A. And perhaps also give a result type since Nothing is a bit weird and not what we're testing for:

Suggested change
def foo[X, Y, Z](x: X, y: Y)[A](z: Z) = ???
def foo[X, Y, Z](x: X, y: Y)[A](z: Z, A: A): (X, Y, Z, A) = ???

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, we should test what happens if the bounds of a type parameter are path-dependent on a previous term parameter.

It might not result in something very sensible, but it should be good enough not to crash Java reflection.

@sjrd sjrd assigned hamzaremmal and unassigned sjrd Oct 7, 2024
@hamzaremmal hamzaremmal assigned sjrd and unassigned hamzaremmal Oct 7, 2024
@hamzaremmal hamzaremmal requested a review from sjrd October 7, 2024 11:07
def bar[X](x: X)[Y <: x.type](y: Y): (X, Y) = (x, y)

@main def Test =
val mtds = Foo.getClass().getDeclaredMethods().filterNot(_.getName() == "writeReplace")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of the methods is not deterministic, I'll order them alphabetically

@hamzaremmal hamzaremmal enabled auto-merge October 7, 2024 11:42
@hamzaremmal hamzaremmal merged commit 588e0b9 into scala:main Oct 7, 2024
27 checks passed
@hamzaremmal hamzaremmal deleted the i21346 branch October 7, 2024 13:46
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
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.

SIP-47 Clause Interleaving + Java = bad class file error
3 participants