Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect caching with dependent method parameters #21699

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

smarter
Copy link
Member

@smarter smarter commented Oct 3, 2024

The added test case used to fail Ycheck:typer with the seemingly identicals:

Found:    (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})]
Required: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})]

In fact one of the aa is a a TypeVar instantiated to A {type B = Int }. The MethodType comparison failed the signature check because the a.B where a is backed by a type variable had a stale signature cached.

Fixed by changing isProvisional to traverse ParamRefs.

@smarter smarter added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Oct 3, 2024
@smarter smarter changed the title Fix incorrect caching with path-dependent types Fix incorrect caching with path-dependent types in methods Oct 3, 2024
@smarter smarter changed the title Fix incorrect caching with path-dependent types in methods Fix incorrect caching with dependent method parameters Oct 3, 2024
@smarter smarter self-assigned this Oct 3, 2024
The added test case used to fail Ycheck:typer with the seemingly identicals:

    Found:    (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})]
    Required: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})]

In fact one of the `aa` is a a TypeVar instantiated to `A {type B = Int }`. The
MethodType comparison failed the signature check because the `a.B` where `a` is
backed by a type variable had a stale signature cached.

Fixed by changing `isProvisional` to traverse ParamRefs.
@odersky odersky merged commit 8a104fd into scala:main Oct 5, 2024
28 checks passed
@odersky odersky deleted the fix-isProvisional branch October 5, 2024 14:52
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants