Skip to content

Conversation

@Linyxus
Copy link
Contributor

@Linyxus Linyxus commented May 20, 2025

fixes #19076

@noti0na1 noti0na1 requested a review from Copilot May 22, 2025 12:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #19076 by improving type adaptation during box adaptation by widening named types.

  • Adds a test case in the captures suite to validate impure capture checking.
  • Modifies the CheckCaptures component to introduce a widening strategy for named types and a fallback check using the widened type.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/pos-custom-args/captures/cc-tvar-impure.scala Adds a test scenario to assess correct type capture handling.
compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala Implements widening of named types with helper functions and fallback logic during box adaptation.
Comments suppressed due to low confidence (1)

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala:1338

  • [nitpick] Consider renaming 'tryThisType' to 'isInitiallyCompatible' to more clearly convey that the function checks the initial compatibility before attempting widening.
def tryThisType: Boolean =

@Linyxus Linyxus closed this Aug 25, 2025
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.

Under CC, subtyping between a type variable and its impure upper bound is rejected

1 participant