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

add support for 3.0.0-M2 #2

Merged
merged 1 commit into from
Nov 25, 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is a Scala micro-library that provides:

The intent is that you can use this instead of `TypeTag` or other heavy machinery.

TypeName is compiled for Scala **2.12**, **2.13**, and **3.0.0-M1**.
TypeName is compiled for Scala **2.12**, **2.13**, **3.0.0-M1**, and **3.0.0-M2**.


```scala
Expand Down
12 changes: 7 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

// Our Scala versions.
lazy val `scala-3.0` = "3.0.0-M1"
lazy val `scala-2.12` = "2.12.12"
lazy val `scala-2.13` = "2.13.3"
lazy val `scala-3.0` = "3.0.0-M2"
lazy val `scala-3.0-prev` = "3.0.0-M1"
lazy val `scala-2.12` = "2.12.12"
lazy val `scala-2.13` = "2.13.3"

// Publishing
name := "typename"
Expand All @@ -24,7 +26,7 @@ headerLicense := Some(HeaderLicense.Custom(

// Compilation
scalaVersion := `scala-2.13`
crossScalaVersions := Seq(`scala-2.12`, `scala-2.13`, `scala-3.0`)
crossScalaVersions := Seq(`scala-2.12`, `scala-2.13`, `scala-3.0-prev`, `scala-3.0`)
Compile / doc / scalacOptions --= Seq("-Xfatal-warnings")
Compile / doc / scalacOptions ++= Seq(
"-groups",
Expand All @@ -33,7 +35,7 @@ Compile / doc / scalacOptions ++= Seq(
)

// MUnit
libraryDependencies += "org.scalameta" %% "munit" % "0.7.18" % Test
libraryDependencies += "org.scalameta" %% "munit" % "0.7.19" % Test
testFrameworks += new TestFramework("munit.Framework")

// Scala 2 needs scala-reflect
Expand Down
21 changes: 21 additions & 0 deletions src/main/scala-3.0.0-M2/TypeNamePlatform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2020 by Rob Norris
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package org.tpolecat.typename

import scala.quoted._

trait TypeNamePlatform {

inline given [A] as TypeName[A] =
${TypeNamePlatform.impl[A]}

}

object TypeNamePlatform {

def impl[A](using t: Type[A], ctx: Quotes): Expr[TypeName[A]] =
'{TypeName[A](${Expr(Type.show[A])})}

}