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

Fix TreeTypeMap to correctly substitute type parameters #14537

Merged
merged 5 commits into from Feb 23, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Feb 22, 2022

Fix TreeTypeMap to correctly substitute parameters when copying local class members.

Fixes #12508

`trace` is made for multi-line output, since it has to show large parts of programs
accurately. Replacing newline with space does not work here. It messes up the layout
and changes the meaning of code.
Fix TreeTypeMap to correctly substitute parameters when copying local class members.

Fixes scala#12508
@odersky odersky changed the title Fix TreeTypeMap to correctly substitute parameters Fix TreeTypeMap to correctly substitute type parameters Feb 22, 2022
@nicolasstucki
Copy link
Contributor

We should also include the original example as a regression test.

class Test {
  inline def test(fun: => Any): Any = fun
  test {
    case class Pair[X, Y](
      x: X,
      y: Y,
    )
  }
}

Otherwise LGTM.

TreeCheck fails if imports are in code that needs a change owner.
@odersky
Copy link
Contributor Author

odersky commented Feb 22, 2022

Original test is now included and I also fixed some other issues when mapping class hierarchies,

  • don't retype imports
  • fix logic for re-establishing companion objects
  • fix logic for re-establishing Child annotations

Together, this means that we can now map embedded enums.

If sealed classes are mapped in TypeTreeMap or mapSymbols, their
children have to be mapped accordingly.
@nicolasstucki nicolasstucki merged commit c1f71db into scala:main Feb 23, 2022
@nicolasstucki nicolasstucki deleted the fix-12508 branch February 23, 2022 19:18
@Kordyjan Kordyjan added this to the 3.1.3 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.

Weird Case Class Compiler Error with Inline Function
4 participants