Skip to content

Commit

Permalink
Merge pull request #2 from tpolecat/3.0.0-M2
Browse files Browse the repository at this point in the history
add support for 3.0.0-M2
  • Loading branch information
tpolecat authored Nov 25, 2020
2 parents 8f19cb0 + ebe58d3 commit bc0e81e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
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
File renamed without changes.
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])})}

}

0 comments on commit bc0e81e

Please sign in to comment.