diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/generic.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/main/scala/generic.scala b/core/src/main/scala/generic.scala index 3355e32..63f3d8f 100644 --- a/core/src/main/scala/generic.scala +++ b/core/src/main/scala/generic.scala @@ -18,6 +18,20 @@ class Macros(val c: whitebox.Context) { val scope = GlobalState.globalState.asInstanceOf[Map[Type, TermName]] + scope.get(genericType) match { + case Some(ref) => + q"$ref" + case None => + + val searchType = appliedType(typeConstructor, genericType) + println(s"${scope.keySet} vs $genericType") + println(s"inferring on $genericType") + try c.inferImplicitValue(searchType, false, false) catch { + case e: Exception => + go(genericType, typeConstructor/*, scope*/) + } + } + scope.get(genericType).map { nm => println("substituting "+nm) q"$nm" |