Skip to content

Conversation

@dwijnand
Copy link
Member

Fixes #15385

@dwijnand dwijnand force-pushed the java-generic-bounds branch from 054dd3d to c7e88c2 Compare November 30, 2022 22:29
@dwijnand dwijnand marked this pull request as ready for review December 1, 2022 12:33
@dwijnand dwijnand requested a review from jan-pieter December 1, 2022 12:33
@dwijnand dwijnand requested review from nicolasstucki and removed request for jan-pieter December 1, 2022 12:34
Copy link
Contributor

@jan-pieter jan-pieter left a comment

Choose a reason for hiding this comment

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

import SymUtils._
import TypeUtils._
import config.Printers.transforms
import reporting.trace
Copy link
Contributor

Choose a reason for hiding this comment

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

Imports w.r.t. debugging can be dropped

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'd love to never have to import them, so this is 1 more file that won't have to happen...


class Foo:
def testNoParam[A <: Int]: A = 1.asInstanceOf[A]
def testSingleParam[A <: Int](a: A): A = 2.asInstanceOf[A] // <A:Ljava/lang/Object;>(I)I
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we drop the generic signature here entirely? In the end it's just int => int

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 think it's a matter of taste a this point. From Java, there's no more link between any passed type argument and the term argument, but maybe there is still a type argument you can provide - so that's why I kept it, as well as it being easier to implement it this way. Unless we have a real reason to drop it, I think this is good.

@dwijnand
Copy link
Member Author

@dwijnand Can we now drop the check at main/compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala#L850-L854 as well?

I think I tried earlier and it failed (and I didn't look more into it at the time) but, good shout, because it looks like we can now.

This reverts commit 5cdb001.

Breaks in CI, here's a snippet:

    [info] Test dotty.tools.dotc.BootstrappedOnlyCompilationTests.posWithCompiler started
    -- Error: compiler/src/dotty/tools/dotc/transform/CapturedVars.scala:31:20 ---------------------------------------------
    31 |  private[this] var Captured: Store.Location[util.ReadOnlySet[Symbol]] = _
       |                    ^
       |compiler bug: created invalid generic signature for variable Captured in dotty.tools.dotc.transform.CapturedVars
       |signature: I
       |if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
       |
@dwijnand dwijnand force-pushed the java-generic-bounds branch from c4fe39d to be10979 Compare December 13, 2022 14:31
@dwijnand dwijnand assigned smarter and unassigned nicolasstucki Dec 13, 2022
@dwijnand dwijnand requested review from smarter and removed request for nicolasstucki and smarter December 13, 2022 23:45
@smarter smarter merged commit 2e409c6 into scala:main Dec 14, 2022
@dwijnand dwijnand deleted the java-generic-bounds branch December 14, 2022 17:46
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
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.

Invalid generic signature for type params bounded by primitive

5 participants