-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6286: Fix ElimOpaque transformation #6298
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
SymTransformers used to transform only SymDenotations. But that does not work for ElimOpaque, where we also have to transform SingleDenotations that refer to opaque helpers.
@@ -60,11 +60,14 @@ object DenotTransformers { | |||
/** A transformer that only transforms SymDenotations */ | |||
trait SymTransformer extends DenotTransformer { | |||
|
|||
/** Tramsform the info of a denotation that is not a Symdenotation */ | |||
def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = 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.
I would call it transformNonSymInfo
to avoid confusion. Or perhaps just make ElimOpaque a regular DenotTransformer, we can always add another kind of Transformer later if we find more uses for it.
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.
OK for transformNonSymInfo
. I think it's better to leave it there to make it clear that something has to be done if a SymTranformer also changes the infos of symbols.
def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation | ||
|
||
def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ref match { | ||
case ref: SymDenotation => transformSym(ref) | ||
case _ => ref | ||
case _ => ref.derivedSingleDenotation(ref.symbol, transformInfo(ref.info, ref.symbol)) |
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.
Isn't derivedSingleDenotation
going to force the info of the ref?
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.
Ah in fact ref.info on that line does that more directly :). That means we're suddenly forcing all infos of non-sym SingleDenotations which doesn't sound ideal.
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.
You are right. Let's make it a DenotTransformer instead.
#6287 is also fixed by this PR |
SymTransformers used to transform only SymDenotations. But that does not work for
ElimOpaque, where we also have to transform SingleDenotations that refer to opaque
helpers.