Skip to content

Fix Java record problems (#19578) and (#19386) - #19583

Merged
bishabosha merged 6 commits into
scala:mainfrom
yilinwei:issue-19578
Feb 9, 2024
Merged

Fix Java record problems (#19578) and (#19386)#19583
bishabosha merged 6 commits into
scala:mainfrom
yilinwei:issue-19578

Conversation

@yilinwei

@yilinwei yilinwei commented Jan 31, 2024

Copy link
Copy Markdown
Contributor

This is a dependency of #19577 and should be reviewed and merged first.

fixes #18639
fixes #19386
fixes #19578

@nicolasstucki

Copy link
Copy Markdown
Contributor

It seems that #19578 is still failing.

@nicolasstucki nicolasstucki self-assigned this Feb 1, 2024
@bishabosha

Copy link
Copy Markdown
Member

should link this to #18639

@yilinwei

yilinwei commented Feb 1, 2024

Copy link
Copy Markdown
Contributor Author

@nicolasstucki, @bishabosha

I started taking a look at this. I don't think the issue is in the parser - the type parameter looks good within the JavaParser - pretty sure the issue is in the Desugar.classDef. I can take this over since it pretty much overlaps with #19577 if you haven't made progress with the issue.

@bishabosha

Copy link
Copy Markdown
Member

@yilinwei I haven't started anything yet so please feel free

This fixes a whole host of subtle issues.

 - The type parameter was not stamped correctly on the constructor
   causing the original error
 - The parsed record was not stamped with `JavaDefined`, which meant
   the duplicate constructors in the case of overrides were not
   removed.
@yilinwei yilinwei changed the title Add regression test for generic records (#19578) Fix (#19578) Feb 1, 2024
@yilinwei yilinwei changed the title Fix (#19578) Fix generic records (#19578) Feb 1, 2024
@yilinwei

yilinwei commented Feb 1, 2024

Copy link
Copy Markdown
Contributor Author

Turned out you were right, problem was in the parser @bishabosha, and that the parsed tree didn't trigger the correct branches within the Namer causing it to duplicate the type parameters on the primary constructor.

This should be all good to go, if it doesn't cause any other regressions.

We change the proxy method to take in a single argument. This also
exposed a second issue where the overriden methods were not
invalidated correctly in the `Namer`.
@yilinwei yilinwei changed the title Fix generic records (#19578) Fix Java record problems (#19578) and (#19386) Feb 1, 2024
Comment thread compiler/src/dotty/tools/dotc/typer/Namer.scala
@yilinwei

yilinwei commented Feb 8, 2024

Copy link
Copy Markdown
Contributor Author

@nicolasstucki @bishabosha is there anything I can do to help move this along?

@bishabosha

Copy link
Copy Markdown
Member

I've just been busy, sorry, free tomorrow

@bishabosha bishabosha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good, and I tried with some other variants, thanks for seeing this through!

@bishabosha
bishabosha enabled auto-merge February 9, 2024 14:38
@bishabosha
bishabosha dismissed noti0na1’s stale review February 9, 2024 14:40

comments were addressed

@bishabosha
bishabosha merged commit 2c0b021 into scala:main Feb 9, 2024
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
@He-Pin

He-Pin commented Mar 16, 2024

Copy link
Copy Markdown
Contributor

@Kordyjan Will this be backported to 3.3.x?

@SethTisue SethTisue added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Mar 16, 2024
@ek-gh

ek-gh commented Apr 4, 2024

Copy link
Copy Markdown

I too am anxiously waiting for this to be back-ported to 3.3.x as well.

WojciechMazur added a commit that referenced this pull request Jul 1, 2024
)

Backports #19583 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur removed the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Nov 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

9 participants