Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix silly mistake in Liftable[Boolean => T]
- Loading branch information
Martin Duhem
committed
Apr 14, 2015
1 parent
0bc2bbe
commit 8fd57c7
Showing
3 changed files
with
25 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,13 @@ package org.duhemm.parsermacro.quasiquotes | |
import org.scalameta.adt.{ Liftables => AdtLiftables } | ||
|
||
import scala.reflect.macros.blackbox.Context | ||
import scala.reflect.macros.Universe | ||
|
||
import scala.meta.{ Dialect, Input, Token } | ||
|
||
trait TokenQuasiquoteLiftables extends AdtLiftables { | ||
val u: scala.reflect.macros.Universe | ||
val u: Universe | ||
val c: Context | ||
|
||
import u._ | ||
|
||
|
@@ -28,9 +30,8 @@ trait TokenQuasiquoteLiftables extends AdtLiftables { | |
q"new _root_.scala.meta.Input { val content: _root_.scala.Array[_root_.scala.Char] = ${new String(input.content)}.toArray }" | ||
} | ||
|
||
implicit def liftBool2T[T: Liftable]: Liftable[Boolean => T] = Liftable[Boolean => T] { f => | ||
val tpe = weakTypeOf[T] | ||
q"(x: $tpe) => if (x) ${f(true)} else ${f(false)}" | ||
implicit def liftBool2T[T : c.WeakTypeTag : Liftable]: Liftable[Boolean => T] = Liftable[Boolean => T] { f => | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Duhemm
Owner
|
||
q"(x: Boolean) => if (x) ${f(true)} else ${f(false)}" | ||
} | ||
|
||
implicit def liftToken: Liftable[Token] = materializeAdt[Token] | ||
|
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
Does this need a typetag now?