Repository navigation
Conversation
`Ops[F, A] { type TypeClassType = Align[F] }` printed as `Ops[F, A]`, and an
`Aux` alias lost the type member it pins. Type and term refinements now print
their members. A member naming a sibling prints its bare name instead of
tasty-query's RecThis, and a refinement written without a parent no longer
prints the Object the compiler fills in.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NKsT2pk4Cgn8JG8KsYEWoP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NKsT2pk4Cgn8JG8KsYEWoP
TASTy stores `[X] => F[X] => G[X]` as PolyFunction refined with its apply; it printed as that refinement. As dotty's RefinedPrinter does, it now prints as a function, with the parameter names Desugar invented left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NKsT2pk4Cgn8JG8KsYEWoP
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #206.
Type and term refinements printed as their parent only, so
Aux-style types lost the member they pin:This builds on the backup-branch commit (d262e19) and fixes the two problems its review found:
def struct: { type A; def get: A }printeddef get: RecThis.A. Dotty'sTypeAssignercloses a refinement over itself (RecType.closeOver(… substThis(refineCls, rt.recThis))), so aRecThisprefix stands for the bare sibling name the source wrote. It now printsA. Dotty's own printer names the binder instead ({z1 => Object{type A; def get: z1.A}}in the 3.7.4 REPL); cellar follows the source here.Objectparent:type Tupled[F[_]] = { type Ap[X, Y] = F[(X, Y)] }printed= Object { … }. Dotty'sTyper.typedRefinedTypeTreefills an omitted parent withObject, and scalac withAnyRef. The new helperisOmittedRefinementParentleaves a parent that dealiases toObjectout. An explicitly writtenObject { … }can't be told apart once compiled, so it loses theObjecttoo. Dotty's printer keeps it (Object{type Ap[X,Y] = …}).[X] => F[X] => G[X]is stored asPolyFunctionrefined withapply, and so is a dependent(x: A) => x.TonFunctionN. As in dotty'sRefinedPrinter(defn.isFunctionType→toTextMethodAsFunction), these print as functions, using the helperisRefinedFunction. Parameter names thatDesugar.makePolyFunctionTypeinvented (x$1, …) are left out, as written in source; dotty leaves them out only under capture checking. Written names stay:[X] => (fx: List[X], n: Int) => Option[X].Ops[Int]{type TC = String}; cellar puts spaces around the braces, as the source does.Benchmark side: the comparison now treats refinement members split by lines and by
;alike. Without that, every multi-member refinement counted as "still differs".Tests: new fixtures cover a sibling reference (Scala 3 and Scala 2) and an
Object-parent alias (Scala 3). Two more fixtures cover poly functions with invented and with written parameter names. Each refinement test fails with its fix disabled. Checked end to end withget-externalon the fixtures and on cats'Alignops conversions.Signature benchmark vs origin/main:
Still differs, out of scope:
type Out[-A, -B, C]: 3 entries in Scala 3, 3 in Scala 2.type E = E0; type R = R0for sourceRthenE): 2 entries.🤖 Generated with Claude Code
https://claude.ai/code/session_01NKsT2pk4Cgn8JG8KsYEWoP