Skip to content

Disambiguate quoted and tasty Type #7404

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

Conversation

nicolasstucki
Copy link
Contributor

This ambiguity can be seen in the following

import scala.quoted._
def f[T: Type](given qctx: QuoteContext) = {
  import qctx.tasty._
  ...
  summon[Type[T]] // qctx.tasty.Type instead of scala.quoted.Type
  ...
}

To avoid the ambiguity we simply rename scala.quoted.Type to TypeTag.
From the 2 this is the one that conforms the least to the common expectation of
what is a Type. We chose TypeTag because it encapsulates the same kind
of information that scala.reflect.TypeTag did.

@nicolasstucki nicolasstucki self-assigned this Oct 10, 2019
@nicolasstucki nicolasstucki force-pushed the disambiguate-quoted-type-and-reflection-type branch 2 times, most recently from 2cff8d7 to 17d3c43 Compare October 10, 2019 17:52
To avoid losing history
@nicolasstucki nicolasstucki force-pushed the disambiguate-quoted-type-and-reflection-type branch 3 times, most recently from dba4b35 to ad9c308 Compare October 10, 2019 19:01
This ambiguity can be seen in the following
```scala
import scala.quoted._
def f[T: Type](given qctx: QuoteContext) = {
  import qctx.tasty._
  ...
  summon[Type[T]] // qctx.tasty.Type instead of scala.quoted.Type
  ...
}
```

To avoid the ambiguity we simply rename `scala.quoted.Type` to `TypeTag`.
From the 2 this is the one that conforms the least to the common expectation of
what is a `Type`. We chose `TypeTag` because it encapsulates the same kind
of information that `scala.reflect.TypeTag` did.
@nicolasstucki nicolasstucki force-pushed the disambiguate-quoted-type-and-reflection-type branch from ad9c308 to 4ce1f56 Compare October 10, 2019 19:08
@nicolasstucki nicolasstucki marked this pull request as ready for review October 10, 2019 19:45
@nicolasstucki
Copy link
Contributor Author

This is a drastic but necessary change. The sooner we make the change, the simpler it will be for users.

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.

LGTM

@biboudis biboudis merged commit 4719e7b into scala:master Oct 11, 2019
@biboudis biboudis deleted the disambiguate-quoted-type-and-reflection-type branch October 11, 2019 11:15
@nicolasstucki
Copy link
Contributor Author

@milessabin this also added a minor change to shapeless

@biboudis biboudis restored the disambiguate-quoted-type-and-reflection-type branch October 11, 2019 14:01
@milessabin
Copy link
Contributor

@nicolasstucki thanks for the heads up!

@nicolasstucki
Copy link
Contributor Author

@milessabin we actually reverted this one for now

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