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

scaladoc can fail at specific macro annotations (Regression from scala 2.11.1 to 2.11.2) #53

Closed
FlorianKirmaier opened this issue Jul 29, 2014 · 6 comments

Comments

@FlorianKirmaier
Copy link

I can compile the following code with "sbt compile" but "sbt doc" fails.
It works with scala 2.11.1 but fails with scala 2.11.2.
I tested paradise version "2.0.1" and "2.1.0-SNAPSHOT".

  import scala.reflect.macros._
  class TestDoc extends StaticAnnotation {
    def macroTransform(annottees: Any*): Any = macro testDocImpl
  }
  def testDocImpl(c: blackbox.Context)(annottees: c.Tree*): c.Tree = {
    import c._
    import c.universe._
    var cc = annottees(0)

    val q"class $clazz(...$args)" = cc
    q"class $clazz(a: Int)"   // this ast can be created
    q"class $clazz(...$args)" // this fails!
  }
      @TestDoc class B(x: Int)
[error] C:\Users\florian.kirmaier\Dropbox\git\SimpleFX\core\src\main\scala\simpl
efx\Test.scala:17: exception during macro expansion:
[error] java.lang.UnsupportedOperationException: Position.point on NoPosition
[error]         at scala.reflect.internal.util.Position.fail(Position.scala:17)
[error]         at scala.reflect.internal.util.UndefinedPosition.point(Position.
scala:95)
[error]         at scala.reflect.internal.util.UndefinedPosition.point(Position.
scala:90)
[error]         at scala.reflect.internal.Positions$class.wrappingPos(Positions.
scala:42)
[error]         at scala.reflect.internal.SymbolTable.wrappingPos(SymbolTable.sc
ala:16)
[error]         at scala.reflect.internal.Positions$class.wrappingPos(Positions.
scala:37)
[error]         at scala.reflect.internal.SymbolTable.wrappingPos(SymbolTable.sc
ala:16)
[error]         at scala.reflect.internal.TreeGen.mkTemplate(TreeGen.scala:378)
[error]         at scala.reflect.internal.ReificationSupport$ReificationSupportI
mpl$SyntacticClassDef$.apply(ReificationSupport.scala:341)
[error]         at scala.reflect.internal.ReificationSupport$ReificationSupportI
mpl$SyntacticClassDef$.apply(ReificationSupport.scala:326)
[error]         at simplefx.wrapping.javafx.package$.testDocImpl(package.scala:6
3)
[error]       @TestDoc class B(x: Int)
[error]        ^
@xeno-by
Copy link
Member

xeno-by commented Jul 29, 2014

Hmm that's not good. Is this a blocker for you?

@FlorianKirmaier
Copy link
Author

It blocks me from upgrading to 2.11.2.
I can use 2.11.1 for the next 3 weeks.
After that, i can work around it, by doing a special 2.11.1 build for the docs.
So no, it doesn't block, but it's realy annoying.

@xeno-by
Copy link
Member

xeno-by commented Jul 30, 2014

I'll see what I can do in the coming days. Thank you for reporting!

@xeno-by
Copy link
Member

xeno-by commented Aug 1, 2014

This is a bug in quasiquotes: https://issues.scala-lang.org/browse/SI-8771. Please follow the discussion over there - I'll try to figure out what can be done as a workaround.

@xeno-by xeno-by closed this as completed Aug 1, 2014
xeno-by added a commit to xeno-by/scalameta that referenced this issue Jan 12, 2015
Had to work around https://issues.scala-lang.org/browse/SI-8771.

Thanks, former myself who's suggested a workaround at scalamacros/paradise#53
and thanks google who indexed the suggestion.
xeno-by added a commit to xeno-by/scalameta that referenced this issue Jan 12, 2015
Had to work around https://issues.scala-lang.org/browse/SI-8771.

Thanks, former myself who's suggested a workaround at scalamacros/paradise#53
and thanks google who indexed the suggestion.
xeno-by added a commit that referenced this issue Jan 12, 2015
xeno-by added a commit that referenced this issue Jan 12, 2015
xeno-by added a commit that referenced this issue Jan 12, 2015
xeno-by added a commit that referenced this issue Jan 12, 2015
xeno-by added a commit that referenced this issue Jan 12, 2015
@xeno-by
Copy link
Member

xeno-by commented Jan 12, 2015

Hi @FlorianKirmaier! Today I faced a similar bug, but the workaround proposed in SI-8771 wasn't enough. After some thinking, I found a way to attack the issue at its root, and now it shouldn't be a problem anymore, regardless of whether the workaround is used or now. The fix has been published under version 2.0.2-SNAPSHOT, 2.1.0-SNAPSHOT and 2.1.0-M3.

@FlorianKirmaier
Copy link
Author

Great to see progress here!

The original code of the sample works now. But unfortunately, I still have a lot of issues with sbt doc. I still get many java.lang.UnsupportedOperationException: Position.point on NoPosition errors.

Another error can be reproduced with the identity annotation from http://docs.scala-lang.org/overviews/macros/annotations.html
/** any doc */ @identity class A

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

No branches or pull requests

2 participants