scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.72k stars 1.04k forks source link

In selector check, respect prefix and compare finalResultType to bound #20894

Open som-snytt opened 1 week ago

som-snytt commented 1 week ago

Fixes #19657

som-snytt commented 1 week ago

Further tweaks forthcoming.

Gedochao commented 5 days ago

@som-snytt how much work do you think it still requires? It seems we might want to backport the fix for #20860 to 3.5.0 at the very least... do you need any help?

som-snytt commented 5 days ago

I'll submit commit 2 separately, as I was about to do except it's one line.

I'll follow up the fix for commit 1 after the American holiday.

som-snytt commented 1 day ago

The previous test fails were because the new prefix check (in isInImport) doesn't apply when isDerived and also for top-level defs where the prefix becomes a package object (not sure if that =:= test should work, or if there's a convenient idiom, or if the check is even useful). The derived check uses dealiased types, not sure if a better mechanism is warranted.

I'll clean up and also look for improvements.