-
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
Changes from 2 commits
9421ff0
e93f8ab
0fadbe3
1c5b8a4
efc48c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Isn't There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. You are right. Let's make it a DenotTransformer instead. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object A { | ||
opaque type T33 = Int | ||
object T33 { | ||
val a = new Array[T33](3) | ||
} | ||
} |
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.