Skip to content

Fix #6419: Support @compileTimeOnly #6424

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 3, 2019

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented May 2, 2019

Support @compileTimeOnly and remove migration waining (see #6419 (comment)).

@nicolasstucki nicolasstucki requested a review from liufengyun May 2, 2019 13:58
@nicolasstucki nicolasstucki force-pushed the fix-#6419 branch 3 times, most recently from ae35b5e to 4b3d0c1 Compare May 2, 2019 15:37
}
case _ => // OK
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In RefChecks.scala, there is commented code:

    /*  (Not enabled yet)
       *  See an explanation of compileTimeOnly in its scaladoc at scala.annotation.compileTimeOnly.
       *
      if (sym.isCompileTimeOnly) {
        def defaultMsg =
          sm"""Reference to ${sym.fullLocationString} should not have survived past type checking,
              |it should have been processed and eliminated during expansion of an enclosing macro."""
        // The getOrElse part should never happen, it's just here as a backstop.
        ctx.error(sym.compileTimeOnlyMessage getOrElse defaultMsg, pos)
      }*/

Maybe we should just revive the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it would not take into account if it is into an erased context or not. Which is already performed in the place where I check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As in https://github.com/lampepfl/dotty/pull/6424/files#diff-a12cb93e6ac05566103dd86ede6e5901R12, where the reference of the @compileTimeOnly is inside an erased def

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Need to drop scalatest changes and rebase over #6444.

Otherwise, LGTM

@nicolasstucki
Copy link
Contributor Author

Dropped scalatest changes and rebased

@nicolasstucki nicolasstucki merged commit 85a53dd into scala:master May 3, 2019
@nicolasstucki nicolasstucki deleted the fix-#6419 branch May 3, 2019 16:04
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.

2 participants