-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Judicious shadowing of implicits from scope #11052
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
base: 2.13.x
Are you sure you want to change the base?
Judicious shadowing of implicits from scope #11052
Conversation
sounds good! i'll need to find some time to look into it. want to run a community build on it early? |
@lrytz thanks, before late bedtime I almost gave you a heads up to ask if you'd like me to continue the PR. Before spending electrons on CB, I'll try some projects locally. I expect to discover more behaviors. Edit: the cycle will need fixing first, I hit it right away. I'll leave the PR open out of sheer optimism. |
Maybe there's nothing better to do than catch & ignore. This is current behavior, regular type check fails in "assign type to tree" because asking if it's a refinement (typedDefDef) means checking all overrides. I see dotty has a
I haven't looked at what problem is solved by "pre-filtering". |
2b25baf
to
111db9d
Compare
111db9d
to
23a43f2
Compare
Has a conflict. I'll try to make some time for reviewing this change. |
I'll freshen the PR and look at it with fresh eyes; my eyes will be fresh right after a cup of coffee. |
Fixes scala/bug#12351
Fixes scala/bug#9208
Retire both the old and new "implicit shadowing" mechanisms in favor of using
ctx.lookupSymbol
.Tweak when
ctx.implicitss
collects implicits from a class by waiting to useowner.thisType.implicitMembers
.A notable improvement in correctness is that overloaded implicits are handled correctly (see
neg/t729.scala
). The spec for lexically scoped implicits is that the value must be "accessible without a prefix". (Probably a member was seen once in a nested context and then again as an overload in the class type, which was taken as shadowed.)The shadowing test in
isQualifyingImplicit
is removed; further clean-up of removed code is still needed after more testing.There are two test tweaks to address which are due to existing cyclic error handling: in one case (
t712
), where one implicit member causes a cycle, the other implicit member is not collected; in the other case (virtpatmat_typetag
), an explicit type is spuriously required for a class tag, also due to an existing cyclic error.Also 2509 switched order when reporting ambiguous, which is supposed to have "winner" first. Maybe benign or progress.