Skip to content

Commit 84b8264

Browse files
committed
fixed position on error coming from ImplicitParam
1 parent c151cc4 commit 84b8264

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

commons-macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package macros.meta
44
import com.avsystem.commons.macros.misc.{Fail, Ok, Res}
55

66
import scala.annotation.StaticAnnotation
7-
import scala.reflect.{ClassTag, classTag}
87

98
trait MacroMetadatas extends MacroSymbols {
109

@@ -152,7 +151,7 @@ trait MacroMetadatas extends MacroSymbols {
152151
if (checked)
153152
tryInferCachedImplicit(tpe).map(n => Ok(q"$n")).getOrElse(Fail(implicitNotFound(tpe)))
154153
else
155-
Ok(q"${infer(tpe)}")
154+
Ok(q"${infer(tpe, matchedSymbol.real)}")
156155
case ParamArity.Optional(tpe) =>
157156
Ok(mkOptional(tryInferCachedImplicit(tpe).map(n => q"$n")))
158157
case _: ParamArity.Multi =>

commons-macros/src/main/scala/com/avsystem/commons/macros/meta/MacroSymbols.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ trait MacroSymbols extends MacroCommons {
101101
def infer(tpt: Tree): TermName =
102102
infer(getType(tpt))
103103

104-
def infer(tpe: Type): TermName =
105-
inferCachedImplicit(tpe, s"$problemStr: ", pos)
104+
def infer(tpe: Type, forSym: MacroSymbol = this): TermName =
105+
inferCachedImplicit(tpe, s"${forSym.problemStr}: ", forSym.pos)
106106

107107
val name: TermName = symbol.name.toTermName
108108
val safeName: TermName = c.freshName(symbol.name.toTermName)

0 commit comments

Comments
 (0)