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

Issue #90, added support for DocDef #124

Merged
merged 4 commits into from
Jan 19, 2019

Conversation

dariuszpm
Copy link
Contributor

#90
Unfortunately it is impossible to implement without casting - compare issues: scala/bug#8904 and scala/bug#7993

case m: DefDef if !m.mods.hasFlag(Flag.PRIVATE) && !m.mods.hasFlag(Flag.PROTECTED) => m
case t if t.isInstanceOf[Trees#DocDef] => matchMethod(t.asInstanceOf[Trees#DocDef].definition.asInstanceOf[Tree])
Copy link
Member

Choose a reason for hiding this comment

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

case t: Trees#DocDef => t.definition.asInstanceOf[Tree] won't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately if you try to do this compilation error will occur:

Error:(256, 23) pattern type is incompatible with expected type;
 found   : scala.tools.nsc.ast.Trees#DocDef
 required: TypeClassMacros.this.c.universe.TreeApi
        case t: Trees#DocDef => matchMethod(t.definition.asInstanceOf[Tree])

Trees from reflect API and NSC aren't compatible. Please check previously linked scala issues.

@mpilquist
Copy link
Member

mpilquist commented Jan 17, 2019

Looks good to me. Could you add a small test?

@dariuszpm
Copy link
Contributor Author

dariuszpm commented Jan 18, 2019

The only proper way to test it is to run sbt doc because additional DocDef tree node in AST is generated only by ScalaDoc.
And since @typeclass is used only in tests then we have to run docs generation for tests.

@dariuszpm
Copy link
Contributor Author

dariuszpm commented Jan 18, 2019

sbt test:doc fails only for scala 2.13.0-M5 and honestly I have no idea why. Will look into it tomorrow.

Edit: it fails regardless of comments or this additional case for DocDef, it seems that scala 2.13 has a huge problem with scaladoc

@mpilquist
Copy link
Member

The 2.13 failure is due to scala/bug#11045 -- fixed in 2.13.0-RC1. I pushed a temporary fix for that to this PR. I'll merge on Travis success and then get a build out.

@mpilquist mpilquist merged commit 5cad4c9 into typelevel:master Jan 19, 2019
@dariuszpm
Copy link
Contributor Author

Ohh, didn't know about this bug. Thanks for info and merging PR.

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.

None yet

2 participants