-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Ignore all kinds of ProtoTypes instead of just AppliedProtos #6715
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
Conversation
liftToClasses used to drop an opaque types from the set of types whose companion modules are included. Opaque types do not have companion modules, but their prefixes might, so it is incorrect to drop them.
The difference is that in an alias type `p.A = q.B` we take `p` instead of `q` as the prefix to search.
In blocks, conditionals and matches we mapped applied prototypes to WildcardTypes in order to force eta expansions. With extension methods the same problem arises for SelectionProtos as well. Furthermore, it makes to sense to propagate a ViewProto into a local context. So the consistent thing to do is to map all kinds of ProtoTypes to WildcardTypes in these situations. This fails one line in run/implicitsFuns.scala, which, however is of dubious value. (The line requires a manually inserted `apply` to propagate a `given` argument into an if-then-else, circumvening the previous "no applies propagated" strategy.
Based on #6712 |
Used to print: <none> does not take parameters.
What does "CB" mean here ? |
@@ -1428,6 +1430,9 @@ object Types { | |||
/** If this is an ignored proto type, its underlying type, otherwise the type itself */ | |||
def revealIgnored: Type = this | |||
|
|||
/** If this is a proto type, the ignored version, otherwise the type itself */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect "ignored version" to mean "IgnoredProto" but we always map to WildcardType instead, so maybe the documentation should read:
/** If this is a proto type, the ignored version, otherwise the type itself */ | |
/** If this is a proto type, WildcardType, otherwise the type itself */ |
(lead /: tp.classSymbols)(joinClass) | ||
case tp: TypeRef => | ||
val sym = tp.symbol | ||
if (sym.isClass || sym.isOpaqueAlias) tp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same condition is repeated in the definition of isLiftTarget
just below, this could be refactored.
@@ -575,8 +582,10 @@ trait ImplicitRunInfo { self: Run => | |||
def computeIScope() = { | |||
val liftedTp = if (isLifted) tp else liftToClasses(tp) | |||
val refs = | |||
if (liftedTp ne tp) | |||
if (liftedTp ne tp) { | |||
implicitsDetailed.println(i"lifted of $tp = $liftedTp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken indentation.
CB = "Community Build". The shapeless 3 part failed. |
In blocks, conditionals and matches we mapped applied prototypes to
WildcardTypes in order to force eta expansions. With extension methods
the same problem arises for SelectionProtos as well. Furthermore,
it makes no sense to propagate a ViewProto into a local context. So the
consistent thing to do is to map all kinds of ProtoTypes to WildcardTypes
in these situations.
This fails one line in run/implicitsFuns.scala, which however is of dubious value.
(The line requires a manually inserted
apply
to propagate agiven
argumentinto an if-then-else, circumventing the usual "no applies propagated" strategy.)