Skip to content

Conversation

mbovel
Copy link
Member

@mbovel mbovel commented Sep 1, 2025

Fixes #22941. Done during the compiler spree of September 1st, 2025.

@mbovel
Copy link
Member Author

mbovel commented Sep 1, 2025

Future work: should we use the same source position (with the complete span) for other messages in RefChecks.checkAllOverrides?

@mbovel
Copy link
Member Author

mbovel commented Sep 1, 2025

Note: there is an existing nameSpan method on trees that implement a similar logic:

def nameSpan(using Context): Span =
if (span.exists) {
val point = span.point
if (rawMods.is(Synthetic) || span.isSynthetic || name.toTermName == nme.ERROR) Span(point)
else {
val realName = srcName.stripModuleClassSuffix.lastPart
Span(point, point + realName.length, point)
}
}
else span

However it seems we can't use it because we don't have a tree for the class when doing the checks in RefChecks. We therefore copied the logic we needed there.

@mbovel mbovel requested a review from tgodzik September 1, 2025 19:51
@mbovel mbovel marked this pull request as ready for review September 2, 2025 09:24
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

@tgodzik tgodzik merged commit 13d4963 into scala:main Sep 2, 2025
44 checks passed
@mbovel mbovel deleted the mb/22941 branch September 2, 2025 15:09
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.

Abstract error message only show the start of the name
2 participants