-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Disallow Phantom types in casts #2525
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
Disallow Phantom types in casts #2525
Conversation
fc859b6
to
aea0cc9
Compare
import dotty.tools.dotc.ast.tpd | ||
|
||
|
||
/** A no-op transform that checks whether the compiled sources have no Phantom types in casts */ |
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.
A no-op transform to ensure that the compiled sources have...
} | ||
|
||
private def checkNoPhantoms(tpTree: tpd.Tree)(implicit ctx: Context): Unit = { | ||
val checker = new TypeMap { |
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.
What not a TypeTraverser
?
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.
Em... will change 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.
+1
/** A no-op transform that checks whether the compiled sources have no Phantom types in casts */ | ||
class CheckPhantomCast extends MiniPhaseTransform { thisTransformer => | ||
|
||
override def phaseName = "checkPhantomCast" |
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.
add a post-condition that those casts don't reappear so that Ycheck will enforce it?
aea0cc9
to
4b5bd1f
Compare
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.
LGTM!
No description provided.