Skip to content
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

semanticdb-scalac + scalamacros/paradise break Scaladoc generation #1072

Closed
olafurpg opened this issue Aug 18, 2017 · 6 comments
Closed

semanticdb-scalac + scalamacros/paradise break Scaladoc generation #1072

olafurpg opened this issue Aug 18, 2017 · 6 comments
Labels

Comments

@olafurpg
Copy link
Member

olafurpg commented Aug 18, 2017

At the following commit
scalacenter/scalafix@9798839
I have the scalahost compiler plugin enabled in the scalafix repo

[error] /home/travis/build/scalacenter/scalafix/scalafix-core/shared/src/main/scala/scalafix/internal/patch/ImportPatchOps.scala:194: don't know how to check whether scala.meta.tokens.Token is scalafix.util.Newline
[error]               val isNewline = x.is[Newline]
[error]                                   ^
[error] /home/travis/build/scalacenter/scalafix/scalafix-core/shared/src/main/scala/scalafix/internal/rewrite/ExplicitReturnTypes.scala:88: don't know how to check whether scala.meta.tokens.Token is scalafix.util.Whitespace
[error]           !x.is[Token.Equals] && !x.is[Whitespace])
[error]                                       ^
[error] /home/travis/build/scalacenter/scalafix/scalafix-core/shared/src/main/scala/scalafix/util/TokenClasses.scala:11: don't know how to check whether scala.meta.tokens.Token is scalafix.util.Newline
[error]     token.is[Space] || token.is[Tab] || token.is[Newline] || token.is[FF]
[error]                                                 ^
[error] /home/travis/build/scalacenter/scalafix/scalafix-core/shared/src/main/scala/scalafix/util/TokenClasses.scala:19: don't know how to check whether scala.meta.tokens.Token is scalafix.util.Whitespace
[error]     token.is[Whitespace] || token.is[Comment]
[error]             ^

The problems seems related to scalamacros/paradise, the following macro annotations in the same projects are not expanded under scaladoc https://github.com/scalacenter/scalafix/blob/016d01cc0286f555bad3ecd898a23ade637786d4/scalafix-core/shared/src/main/scala/scalafix/util/TokenClasses.scala#L7

@xeno-by could analyzer hijacking be conflicting with scalamacros/paradise analyzer hackery under scaladocglobal?

Disabling semanticdb-scalac fixes the problem.

olafurpg added a commit to olafurpg/scalafix that referenced this issue Aug 18, 2017
olafurpg added a commit to olafurpg/scalameta that referenced this issue Aug 25, 2017
It seems semanticdb-scalac conflicts with scalamacros/paradise under
ScaladocGlobal. See scalameta#1072.
olafurpg added a commit to olafurpg/scalameta that referenced this issue Aug 25, 2017
It seems semanticdb-scalac conflicts with scalamacros/paradise under
ScaladocGlobal. See scalameta#1072.
@olafurpg olafurpg changed the title semanticdb-scalac breaks Scaladoc generation semanticdb-scalac + scalamacros/paradise break Scaladoc generation Aug 25, 2017
@olafurpg
Copy link
Member Author

This is increasingly annoying since it's blocking me from using scalafix for development in both the scalameta and scalafix repos. Any idea what might be causing this @xeno-by ?

@xeno-by
Copy link
Member

xeno-by commented Aug 25, 2017

Does the issue only occur when paradise is enabled?

@olafurpg
Copy link
Member Author

Yes, scalamacros/paradise annotations are not expanded causing compile errors.

@xeno-by
Copy link
Member

xeno-by commented Aug 25, 2017

Scalamacros/paradise doesn't do any analyzer hijacking, at least not on Scala 2.11+. Instead, it installs so-called analyzer and macro plugins: https://github.com/scalamacros/paradise/blob/2.12.3/plugin/src/main/scala/org/scalamacros/paradise/Plugin.scala#L14-L15.

If I were to guess, I'd say that semanticdb hijacking replaces the analyzer with the paradise plugins installed with the new analyzer that doesn't have these plugins anymore. Why this happens only under scaladoc - that's not immediately obvious.

@olafurpg
Copy link
Member Author

We could skip hijack under ScaladocGlobal. Unlike scalameta/paradise, the sources compile fine withouth semanticdb enabled.

@olafurpg
Copy link
Member Author

I opened #1095 to fix this.

olafurpg added a commit that referenced this issue Aug 28, 2017
Disable hijacking under ScaladocGlobal, fix #1072.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants