Skip to content

preserve span of this during statification of trait constructors - #25354

Merged
hamzaremmal merged 1 commit into
scala:mainfrom
hamzaremmal:i23413
Feb 25, 2026
Merged

preserve span of this during statification of trait constructors#25354
hamzaremmal merged 1 commit into
scala:mainfrom
hamzaremmal:i23413

Conversation

@hamzaremmal

@hamzaremmal hamzaremmal commented Feb 25, 2026

Copy link
Copy Markdown
Member

In the backend, trait constructors are modified to become static methods that are taking the this as the first parameters. When updating the body of the constructor, we also change the This tree to a reference to the newly added parameter which will have the effect of switching the span to that definition. As such, we preserve the span of the This by copying it.

Closes #23413

In the backend, trait constructors are modified to become static methods that are taking the `this` as the first parameters. when updating the body of the constructor, we also change the `This` tree to a reference to the newly added parameter which will have the effect of swaitching the span of that definition. As such, we preserve the span of the `This` by copying it.

@SolalPirelli SolalPirelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice and clean

@hamzaremmal
hamzaremmal merged commit c0af6f4 into scala:main Feb 25, 2026
104 of 105 checks passed
@hamzaremmal
hamzaremmal deleted the i23413 branch February 25, 2026 21:19
@WojciechMazur WojciechMazur added this to the 3.8.4 milestone Mar 31, 2026
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.

Incorrect LineNumberTable for trait consturctors

4 participants