Skip to content

Update to given ..: T to given .. as T syntax #8242

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

Merged
merged 1 commit into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/src/scala/quoted/Liftable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object Liftable {
else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) }
}

given iArrayIsLiftable[T: Type](using ltArray: Liftable[Array[T]]): Liftable[IArray[T]] {
given iArrayIsLiftable[T: Type](using ltArray: Liftable[Array[T]]) as Liftable[IArray[T]] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Side note: It seems extends is easier to read than as in this case.

def toExpr(iarray: IArray[T]): QuoteContext ?=> Expr[IArray[T]] =
'{ ${ltArray.toExpr(iarray.asInstanceOf[Array[T]])}.asInstanceOf[IArray[T]] }
}
Expand Down
18 changes: 9 additions & 9 deletions library/src/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@ class Type[T <: AnyKind] private[scala] {
/** Some basic type tags, currently incomplete */
object Type {

given UnitTag(using qctx: QuoteContext): Type[Unit] = {
given UnitTag(using qctx: QuoteContext) as Type[Unit] = {
import qctx.tasty.{_, given}
defn.UnitType.seal.asInstanceOf[quoted.Type[Unit]]
}

given BooleanTag(using qctx: QuoteContext): Type[Boolean] = {
given BooleanTag(using qctx: QuoteContext) as Type[Boolean] = {
import qctx.tasty.{_, given}
defn.BooleanType.seal.asInstanceOf[quoted.Type[Boolean]]
}

given ByteTag(using qctx: QuoteContext): Type[Byte] = {
given ByteTag(using qctx: QuoteContext) as Type[Byte] = {
import qctx.tasty.{_, given}
defn.ByteType.seal.asInstanceOf[quoted.Type[Byte]]
}

given CharTag(using qctx: QuoteContext): Type[Char] = {
given CharTag(using qctx: QuoteContext) as Type[Char] = {
import qctx.tasty.{_, given}
defn.CharType.seal.asInstanceOf[quoted.Type[Char]]
}

given ShortTag(using qctx: QuoteContext): Type[Short] = {
given ShortTag(using qctx: QuoteContext) as Type[Short] = {
import qctx.tasty.{_, given}
defn.ShortType.seal.asInstanceOf[quoted.Type[Short]]
}

given IntTag(using qctx: QuoteContext): Type[Int] = {
given IntTag(using qctx: QuoteContext) as Type[Int] = {
import qctx.tasty.{_, given}
defn.IntType.seal.asInstanceOf[quoted.Type[Int]]
}

given LongTag(using qctx: QuoteContext): Type[Long] = {
given LongTag(using qctx: QuoteContext) as Type[Long] = {
import qctx.tasty.{_, given}
defn.LongType.seal.asInstanceOf[quoted.Type[Long]]
}

given FloatTag(using qctx: QuoteContext): Type[Float] = {
given FloatTag(using qctx: QuoteContext) as Type[Float] = {
import qctx.tasty.{_, given}
defn.FloatType.seal.asInstanceOf[quoted.Type[Float]]
}

given DoubleTag(using qctx: QuoteContext): Type[Double] = {
given DoubleTag(using qctx: QuoteContext) as Type[Double] = {
import qctx.tasty.{_, given}
defn.DoubleType.seal.asInstanceOf[quoted.Type[Double]]
}
Expand Down
Loading