Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Dec 3, 2025

An anonymous class is expanded roughly to

{ class $anon{ ... }; new $anon }

Previously the new part had a zero extent span at the end of the class. When used with significant indentation, this caused some puzzlement in error messages since one thought the last class definition was to blame. The span is now the whole anonymous class.

An anonymous class is expanded roughly to

    { class $anon{ ... }; new $anon }

Previously the `new` part had a zero extent span at the end of the class.
When used with significant indentation, this caused some puzzlement in error
messages since one thought the last class definition was to blame. The span
is now the whole anonymous class.
@odersky odersky added the better-errors Issues concerned with improving confusing/unhelpful diagnostic messages label Dec 3, 2025
@odersky odersky requested a review from hamzaremmal December 3, 2025 11:05
@hamzaremmal hamzaremmal enabled auto-merge December 3, 2025 12:23
@hamzaremmal hamzaremmal merged commit 2fc524a into scala:main Dec 3, 2025
46 checks passed
@hamzaremmal hamzaremmal deleted the better-new-span branch December 3, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

better-errors Issues concerned with improving confusing/unhelpful diagnostic messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants