Skip to content

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

Merged
merged 2 commits into from
May 26, 2017

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

import dotty.tools.dotc.ast.tpd


/** A no-op transform that checks whether the compiled sources have no Phantom types in casts */
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What not a TypeTraverser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em... will change it.

Copy link
Contributor

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"
Copy link
Contributor

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?

@nicolasstucki nicolasstucki force-pushed the disallow-casts-on-phantoms branch from aea0cc9 to 4b5bd1f Compare May 24, 2017 15:25
Copy link
Contributor

@OlivierBlanvillain OlivierBlanvillain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nicolasstucki nicolasstucki merged commit 48258c5 into scala:master May 26, 2017
@allanrenucci allanrenucci deleted the disallow-casts-on-phantoms branch December 14, 2017 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants