Skip to content

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Sep 10, 2025

Sibling givens are always eligible for derived members,
which are appended to the enclosing template.

Fixes #23897

Why was the ticket worth tackling?

The behavior change is a regression that makes derived less intuitive.
User-written code is logically antecedent to synthetic derived code.

How I fixed it

I merely confirmed the diagnosis by @mrdziuban on the ticket.
Instead of fiddling with positions, the fix takes derived members as a special case,
where derived members always follow other members.
Perhaps all definitions with a synthetic, zero-extent span deserve the same consideration.

Why is this PR worth reviewing?

It is one LOC that is easy to review if the premise is agreed upon in principle.

What's the worst that could happen?

Existing code that relies on the changed behavior may break.

Sibling givens are always eligible for derived members,
which are appended to the enclosing template.
@som-snytt som-snytt force-pushed the issue/23897-derives-pos branch from 26b2745 to 59943eb Compare October 4, 2025 11:50
@som-snytt som-snytt marked this pull request as ready for review October 4, 2025 11:53
@Gedochao Gedochao requested a review from odersky October 10, 2025 05:23
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Looks like the right fix.

@odersky odersky assigned som-snytt and unassigned odersky Oct 10, 2025
@som-snytt som-snytt merged commit be16a7b into scala:main Oct 10, 2025
49 checks passed
@som-snytt som-snytt deleted the issue/23897-derives-pos branch October 10, 2025 19:39
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.

Derived instances fail to discover givens in the type's companion object

2 participants