Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

For XYZ: Tree, TypeOrBoundTree, TypeOrBound and Constant

For XYZ: Tree, TypeOrBoundTree, TypeOrBound and Constant
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.

Otherwise, LGTM

import scala.tasty.Tasty

class TastyPrinter[T <: Tasty with Singleton](val tasty: T) {
class ShowExtractors[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I hope the name ShowExtractors can be improved later if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@nicolasstucki nicolasstucki merged commit a15cfad into scala:master May 25, 2018
@liufengyun liufengyun deleted the add-tasty-show branch May 25, 2018 13:55
Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request May 25, 2018
Without this change, `showExtractors` is unstable and so is
`showExtractors.tasty`, so `showExtractors.showTypeOrBounds`'s type gets
approximated from `showExtractors.tasty.TypeOrBounds` to its bounds (`Any` or
`Nothing` depending on variance), so the additions to the testcase fail. The
same applies to other members.

I also tried replacing `tasty.Tree` with `T#Tree` (and so on), but apparently
those two types aren't considered equal, at least by Scalac (which is arguably a
bug).

Relates to code added in scala#4577.

// ===== Show =====================================================

def defaultShow: Show[this.type] = showExtractors
Copy link
Contributor

Choose a reason for hiding this comment

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

Using def here makes the member unstable problems, see c9dbecc — I'm not using the API you used, but I'd expect both to work as they usually do.

Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request May 26, 2018
Without this change, `showExtractors` is unstable and so is
`showExtractors.tasty`, so `showExtractors.showTypeOrBounds`'s type gets
approximated from `showExtractors.tasty.TypeOrBounds` to its bounds (`Any` or
`Nothing` depending on variance), so the additions to the testcase fail. The
same applies to other members.

I also tried replacing `tasty.Tree` with `T#Tree` (and so on), but apparently
those two types aren't considered equal, at least by Scalac (which is arguably a
bug).

Relates to code added in scala#4577.
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.

4 participants