Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Aug 9, 2025

  • Special case in some situations so that we only print the name,
    not the underlying type.
  • Print TermParamRefs like other singleton types
  • Use unique names to print empty capture set variables

If the closure has an expected function type with a fully defined result type,
take the internalized result type as the local return type of the closure.

This has the effect that some conformance tests are now done with Fresh instead Result
caps. This means a now can widen a local reference to a result cap, since the comparison
is done between the local reference and the internalized FreshCap. Previously this failed
since we compared a local cap with result cap, and result caps only subtype other result caps.

It also propagates types more aggressively into closure bodies, which sometimes reduces the
error span and improves the error message.
 - Special case in some situations so that we only print the name,
   not the underlying type.
 - Print TermParamRefs like other singleton types
@odersky odersky mentioned this pull request Aug 11, 2025
5 tasks
@odersky odersky requested a review from natsukagami August 11, 2025 17:37
Comment on lines -706 to -713
def levelOK =
if ccConfig.useFreshLevels && !CCState.collapseFresh then
val yOwner = y.levelOwner
yOwner.isStaticOwner || x.ccOwner.isContainedIn(yOwner)
else y.core match
case ResultCap(_) | _: ParamRef => false
case _ => true

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a surprising removal, is it intended?

Copy link
Contributor

@natsukagami natsukagami left a comment

Choose a reason for hiding this comment

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

LGTM except for that removed block

@odersky
Copy link
Contributor Author

odersky commented Aug 12, 2025

The removed levelOK was migrated to x.acceptsLevelOf(y) in a previous PR, but was forgotten to be removed.

@odersky odersky merged commit fa03916 into scala:main Aug 12, 2025
46 checks passed
@odersky odersky deleted the better-cc-errors branch August 12, 2025 08:31
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.

2 participants