Skip to content

Preserve type info when lifting stable arguments - #26063

Merged
SolalPirelli merged 1 commit into
scala:mainfrom
nox213:fix-i25557
May 16, 2026
Merged

Preserve type info when lifting stable arguments#26063
SolalPirelli merged 1 commit into
scala:mainfrom
nox213:fix-i25557

Conversation

@nox213

@nox213 nox213 commented May 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #25557

The type of lifted arguments was always widened, which affects the behavior of avoid and breaks dependent path types in the foo(parent, isFoo)'s result type.

    {
      val parent$1: ConcreteParent = ConcreteParent
      ConcreteParent.foo(parent = parent$1, isFoo = true)((_$2: ConcreteParent)
         => _$2.myInner)
    }

How much have you relied on LLM-based tools in this contribution?

Extensively, for finding which code trigger the bug and how to fix it.

How was the solution tested?

Used reproducer provided from the issue.

@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.

less widening is good, I guess? I'm not super familiar with this, but it's a small change and passes tests

@SolalPirelli
SolalPirelli merged commit 80517e5 into scala:main May 16, 2026
45 checks passed
@nox213
nox213 deleted the fix-i25557 branch May 19, 2026 08:33
@WojciechMazur WojciechMazur added this to the 3.9.0 milestone May 26, 2026
bishabosha pushed a commit to dotty-staging/dotty that referenced this pull request Jun 5, 2026
Fixes scala#25557

The type of lifted arguments was always widened, which affects the
behavior of `avoid` and breaks dependent path types in the `foo(parent,
isFoo)`'s result type.

```scala
    {
      val parent$1: ConcreteParent = ConcreteParent
      ConcreteParent.foo(parent = parent$1, isFoo = true)((_$2: ConcreteParent)
         => _$2.myInner)
    }
```

## How much have you relied on LLM-based tools in this contribution?

Extensively, for finding which code trigger the bug and how to fix it.


## How was the solution tested?

Used reproducer provided from the issue.
Gedochao pushed a commit that referenced this pull request Jul 15, 2026
Closes #23952

The issue was fixed by #26063. Adds a regression test.

## Have you relied on LLM-based tools in this contribution?

No

## How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)
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.

Path dependent type broken in secondary param list when args are reordered

4 participants