Skip to content

Commit

Permalink
should use silent instead of just doing typed
Browse files Browse the repository at this point in the history
  • Loading branch information
xeno-by committed Jan 13, 2014
1 parent 5e38e3b commit b74fbb5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugin/src/main/scala/org/dslparadise/typechecker/Typers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ trait Typers {
val Impo = typeOf[org.dslparadise.annotations.Import]
val desugared = (args zip formals) map {
case (tree, formal @ TypeRef(_, _, List(AnnotatedType(List(AnnotationInfo(Impl, _, _)), left, _), right)))
val tpe = typed(tree.duplicate).tpe
if (!(tpe <:< formal) || tpe.isError) {
val fixed = q"{ implicit u: $left$tree }"
val fixedTpe = typed(fixed).tpe
println(tree, fixed, fixedTpe)
fixed
} else {
tree
silent(_.typed(tree.duplicate)) match {
case SilentResultValue(result) =>
result
case SilentTypeError(_) =>
val fixed = q"{ implicit u: $left$tree }"
val fixedTpe = typed(fixed).tpe
println(tree, fixed, fixedTpe)
fixed
}
case (tree, tp) tree
}
Expand Down

0 comments on commit b74fbb5

Please sign in to comment.