-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak setInfo and do not warn on return of arg
- Loading branch information
Showing
6 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// scalac: -Werror -Wnonunit-statement | ||
// | ||
import scala.reflect.macros._ | ||
import scala.reflect.api.TypeCreator | ||
|
||
abstract trait Encoder[A] extends scala.AnyRef; | ||
object StringContextOps extends scala.AnyRef { | ||
class StringOpsMacros(c: scala.reflect.macros.whitebox.Context) extends scala.AnyRef { | ||
def sql_impl(argSeq: StringOpsMacros.this.c.universe.Tree*): AnyRef = { | ||
val EncoderType: StringOpsMacros.this.c.universe.Type = StringOpsMacros.this.c.universe.typeOf[Encoder[_]](({ | ||
val $u: StringOpsMacros.this.c.universe.type = StringOpsMacros.this.c.universe; | ||
val $m: $u.Mirror = StringOpsMacros.this.c.universe.rootMirror; | ||
$u.TypeTag.apply[Encoder[_]]($m, { | ||
final class $typecreator1 extends TypeCreator { | ||
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { | ||
val $u: U = $m$untyped.universe; | ||
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; | ||
val symdef$EncoderType1: $u.Symbol = $u.internal.reificationSupport.newNestedSymbol($u.internal.reificationSupport.selectTerm($u.internal.reificationSupport.selectType($m.staticModule("StringContextOps").asModule.moduleClass, "StringOpsMacros"), "sql_impl"), $u.TermName.apply("EncoderType"), $u.NoPosition, $u.internal.reificationSupport.FlagsRepr.apply(549755813888L), false); | ||
val symdef$_$11: $u.Symbol = $u.internal.reificationSupport.newNestedSymbol(symdef$EncoderType1, $u.TypeName.apply("_$1"), $u.NoPosition, $u.internal.reificationSupport.FlagsRepr.apply(34359738384L), false); | ||
$u.internal.reificationSupport.setInfo[$u.Symbol](symdef$EncoderType1, $u.NoType); | ||
$u.internal.reificationSupport.setInfo[$u.Symbol](symdef$_$11, $u.internal.reificationSupport.TypeBounds($m.staticClass("scala.Nothing").asType.toTypeConstructor, $m.staticClass("scala.Any").asType.toTypeConstructor)); | ||
$u.internal.reificationSupport.ExistentialType(scala.collection.immutable.List.apply[$u.Symbol](symdef$_$11), $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.thisPrefix($m.EmptyPackageClass), $m.staticClass("Encoder"), scala.collection.immutable.List.apply[$u.Type]($u.internal.reificationSupport.TypeRef($u.NoPrefix, symdef$_$11, scala.collection.immutable.Nil)))) | ||
} | ||
}; | ||
new $typecreator1() | ||
}) | ||
}: StringOpsMacros.this.c.universe.TypeTag[Encoder[_]])); | ||
argSeq.head | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// scalac: -Werror -Wnonunit-statement | ||
|
||
import scala.reflect.macros._ | ||
|
||
trait Encoder[A] | ||
|
||
object StringContextOps { | ||
class StringOpsMacros(val c: whitebox.Context) { | ||
import c.universe._ | ||
def sql_impl(argSeq: Tree*): Tree = { | ||
val EncoderType = typeOf[Encoder[_]] | ||
argSeq.head | ||
} | ||
} | ||
} |