scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Support Mirror synthesis for local and inner classes

Open bishabosha opened this issue 3 years ago • 3 comments

A new PR which takes a simpler approach - compute a prefix for the child and use asSeenFrom

  • update child accessibility check for anonymous mirrors in whyNotGenericSum. Now check the prefix at the callsite can access the child.
  • for sum mirrors, compute a new prefix for each child from the callsite prefix of the parent, see TypeOps.childPrefix. For each child, subsititute its prefix at definition with the childPrefix using asSeenFrom. For polymorphic classes, perform the subsitution on the constructor before inferring constraints.
  • add tests for issues 13332, 13935, 11174, 12328
  • add tests for local/inner classes taken from Shapeless for its Generic type, backed by mirrors

fixes https://github.com/lampepfl/dotty/issues/13332 fixes https://github.com/lampepfl/dotty/issues/12328 fixes https://github.com/lampepfl/dotty/issues/11174 fixes https://github.com/lampepfl/dotty/issues/13935

bishabosha avatar Aug 11 '22 12:08 bishabosha

test performance please

bishabosha avatar Aug 11 '22 14:08 bishabosha

performance test scheduled: 1 job(s) in queue, 0 running.

dottybot avatar Aug 11 '22 14:08 dottybot

Performance test finished successfully:

Visit https://dotty-bench.epfl.ch/15847/ to see the changes.

Benchmarks is based on merging with main (e560c2d697)

dottybot avatar Aug 11 '22 15:08 dottybot

should this be back ported to 3.2.0 - e.g. 3.2.0 won't be able to summon a mirror for a local class compiled by 3.2.1, so that makes it a forward source compatibility breaking change

bishabosha avatar Aug 16 '22 12:08 bishabosha

doing the backport PR now

bishabosha avatar Aug 17 '22 14:08 bishabosha