Skip to content

Conversation

@phaller
Copy link
Owner

@phaller phaller commented Dec 5, 2016

This implementation is designed to be more robust:

  • Excluded type members are supported without rewriting code
    generated by a macro.
  • Constraints are expressed without creating a Captured type
    member. This makes it possible to only use a blackbox macro.

This implementation is designed to be more robust:
- Excluded type members are supported without rewriting code
  generated by a macro.
- Constraints are expressed without creating a Captured type
  member. This makes it possible to only use a blackbox macro.
Copy link

@jvican jvican left a comment

Choose a reason for hiding this comment

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

Yeah, I like the fact that the brittle interaction between excluded and captured disappears. I ran into some issues two months ago. Most of the simplification is already done in my impl, especifically the bits to detect non captured variables. I put some references in the comments 😄. Thanks for showing this, I'll try to create explicit conversions for spores with Excluded types inspiring me in this prototype!

})

def symbolNotCaptured(sym: Symbol): Boolean =
sym.isStatic || ownerChainContains(sym, fun.symbol)
Copy link

Choose a reason for hiding this comment

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

Classes are considered static as well. Yes, isStatic does not work as the reflect docs advertise. I ended up doing this checks https://github.com/scalacenter/spores/blob/master/core/src/main/scala/scala/spores/SporeAnalysis.scala#L117.

Copy link

Choose a reason for hiding this comment

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

BTW, classes do not fail in neg tests because the toolbox wraps them in an object (and a method), and therefore the true meaning of isStatic (as top-level) does not hold.

var captured: List[Symbol] = List()
val traverser = new Traverser {
override def traverse(tree: Tree): Unit = tree match {
case id: Ident =>
Copy link

Choose a reason for hiding this comment

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

Missing super and this cases ? 😄

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