Type mismatch with implicit macro: how to diagnose this?

I have a very simple macro that takes a function and generates a tuple. The first element contains some information about the function and the second is the tuple itself. Unfortunately I have a case that generates a type mismatch which is a mystery to me. More curiously if I copy & paste the calling function were the implicit macro is used but only change the function name, then it works. I suspect their may be some problem with the called function but cannot find out how to diagnose this. So how do I diagnose the following code?

Say this is the function to analyze and its parameter:

   def concatFunc(ap:String, i:String):Either[ADWError, String] = Right(i + ap)
   val ap = "_3"

This is how I can call the macro nameFunc explicitly and use the result:

    val input = "input"

    val tmp: (TaskInfo, (String, String) => Either[ADWError, String]) = nameFunc(concatFunc _)
    val name = tmp._1
    val f = tmp._2
    val tt: Func[String, String, Unit] = Func( toTask1(f, ap, name) )
    tt.t.f(input)

Func is simply a wrapper. The definition of toTask1 is at the end of this message. Now I have a function T that does what I have shown above. I can call this with the macro explicitly:

    val ts = T(nameFunc(concatFunc _), ap)
    ts.t.f(input)

This compiles and executes correctly. So far so good. But now if I call T without the explicit call to the macro so:

    val concat0 =  T(concatFunc _, ap)
    concat0.t.f(input)

I get an error:

[error] /home/u/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala:63:22: type mismatch;
[error]  found   : (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String])
[error]  required: (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => pt.inescn.search.stream.Tasks.Out[String])
[error]     (which expands to)  (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => scala.util.Either[pt.inescn.utils.ADWError,String])
[error]     val concat0 =  T(concatFunc _, ap)

So the question is, why does T expect a Char. After battling with this for some time I did the following experiment. First I replicate the T and renamed it T1. So for the various overloaded Ts I now have a T1:

  def T[I,O](named_func: (TaskInfo, I => Out[O])): Func[I,O,Unit] = {
    val name = named_func._1
    val f = named_func._2
    Func( toTask0(f, name) )
  }

  def T[I,O,P1](named_func: (TaskInfo, (P1,I) => Out[O]), p1: P1): Func[I,O,Unit] =  {
    val name = named_func._1
    val f = named_func._2
    Func( toTask1(f, p1, name) )
  }

  def T1[I,O,P1](named_func: (TaskInfo, (P1,I) => Out[O]), p1: P1): Func[I,O,Unit] =  {
    val name = named_func._1
    val f = named_func._2
    Func( toTask1(f, p1, name) )
  }

  def T[I,O,P1,P2](named_func: (TaskInfo, (P1,P2,I) => Out[O]), p1:P1, p2:P2): Func[I,O,Unit] =  {
    val name = named_func._1
    val f = named_func._2
    Func( toTask2(f, p1, p2, name) )
  }

And now I made what essentially is the same call so:

    val concat1 =  T1(concatFunc _, ap)
    concat1.t.f(input)

This compiles correctly too. In order to diagnose the problem, i used the flag -Ymacro-debug-lite (see [1]). In the case of the T1 call I get:

Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
performing macro expansion pt.inescn.macros.TaskMacro.nameFunc[(String, String) => Either[pt.inescn.utils.ADWError,String]]({
  ((ap: String, i: String) => concatFunc(ap, i))
}) at source-/home/u/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-59,offset=1801
scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
})

And for the case of T I get:

Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
performing macro expansion pt.inescn.macros.TaskMacro.nameFunc[(String, String) => Either[pt.inescn.utils.ADWError,String]]({
  ((ap: String, i: String) => concatFunc(ap, i))
}) at source-/home/u/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-63,offset=1888
scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
})
Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
[error] /home/u/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala:63:22: type mismatch;
[error]  found   : (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String])
[error]  required: (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => pt.inescn.search.stream.Tasks.Out[String])
[error]     (which expands to)  (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => scala.util.Either[pt.inescn.utils.ADWError,String])
[error]     val concat0 =  T(concatFunc _, ap)
[error]                      ^

I noticed the following:

  • the macro is in fact called and generated the same (expected) output as for T1
  • but then their is another output of the AST which does not seem to be related to the macro in question.

So now I am at a loss to know what is going on. I also tried using a version of the function with a Char and that works. I also used the full path to T and that also does not work.

Can anyone give me any pointers? Much code is involved so I did not attempt to simplify this but that the code is available in a repo for experimenting.

TIA

    def toTask1[I,O,P1](func:(P1,I) => Out[O], p:P1, nm:TaskInfo): Task[I,O,Unit] = new Task[I,O,Unit] {

      override val name: String = nm.funcName
      override val params: Params = Map( nm.params.head -> p )
      def f(i:I):Out[O] = func(p,i)

      override def zero: Unit = ()
      override def collect(acc: Unit, i: Either[ADWError, O], ta:Long, tb:Long, track: Executing): Unit = ()
    }

. https://docs.scala-lang.org/overviews/compiler-options/index.html

Additional information. I extracted the verbose macro related information. Apologies for using a reply but this would make the message far too large.

This is for the working T1 :

looking for macro implementation: macro method nameFunc
calculateUndetparams: Set()
performing macro expansion pt.inescn.macros.TaskMacro.nameFunc[(String, String) => Either[pt.inescn.utils.ADWError,String]]({
  ((ap: String, i: String) => concatFunc(ap, i))
}) at source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-54,offset=1615
context: MacroContext(nameFunc@source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-54,offset=1615 +0)
prefix: pt.inescn.macros.TaskMacro
targs: List((String, String) => Either[pt.inescn.utils.ADWError,String])
argss: List(List({
  ((ap: String, i: String) => concatFunc(ap, i))
}))
paramss: List(List(value a))
binding: MacroImplBinding(false,true,pt.inescn.macros.TaskMacro$,namedFuncImpl,List(List(Other), List(Expr), List(Tag(0))),List(T))
trees: List(List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
})))
tags: List(WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
macroImplArgs: List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
}), WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
original:
scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
})
Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
blackbox typecheck (against pt = ?): (scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
}): (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String]))
undetParam added: type T1
undetParam added: type T2
undetParam added: type A
undetParam inferred: type A as String
undetParam inferred: type T1 as pt.inescn.macros.MacroCore.TaskInfo
undetParam inferred: type T2 as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type I
undetParam added: type O
undetParam added: type P1
undetParam inferred: type I as String
undetParam inferred: type O as String
undetParam inferred: type P1 as String
undetParam added: type I
undetParam added: type O
undetParam added: type P1
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
macroExpand: expander = scala.tools.nsc.typechecker.Macros$DefMacroExpander@2bf35f8b, expandee = Apply[1](TypeApply[2](Select[3](Select[4](Select[5](Select[6](Ident[7](pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.TaskMacro#12699), TermName("nameFunc")#12912), List(TypeTree[8]())), List(Block[8](List(), Function[8](List(ValDef[9](Modifiers(PARAM | SYNTHETIC), TermName("ap")#33316, TypeTree[10](), EmptyTree), ValDef[9](Modifiers(PARAM | SYNTHETIC), TermName("i")#33317, TypeTree[10](), EmptyTree)), Apply[11](Ident[12](TermName("concatFunc")#14365), List(Ident[10](TermName("ap")#33316), Ident[10](TermName("i")#33317)))))))
[1] TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))))))
[2] MethodType(List(TermName("a")#33322), TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()))))))))
[3] PolyType(List(TypeName("T")#12970), MethodType(List(TermName("a")#12971), TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(NoPrefix, TypeName("T")#12970, List())))))
[4] SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.TaskMacro#12699)
[5] SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642)
[6] SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618)
[7] SingleType(ThisType(<root>#2), pt#30)
[8] TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))))
[9] NoType
[10] TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())
[11] TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))
[12] MethodType(List(TermName("ap")#31535, TermName("i")#31536), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))), desugared = ()
looking for macro implementation: macro method nameFunc
calculateUndetparams: Set()
performing macro expansion pt.inescn.macros.TaskMacro.nameFunc[(String, String) => Either[pt.inescn.utils.ADWError,String]]({
  ((ap: String, i: String) => concatFunc(ap, i))
}) at source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-57,offset=1676
context: MacroContext(nameFunc@source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-57,offset=1676 +0)
prefix: pt.inescn.macros.TaskMacro
targs: List((String, String) => Either[pt.inescn.utils.ADWError,String])
argss: List(List({
  ((ap: String, i: String) => concatFunc(ap, i))
}))
paramss: List(List(value a))
binding: MacroImplBinding(false,true,pt.inescn.macros.TaskMacro$,namedFuncImpl,List(List(Other), List(Expr), List(Tag(0))),List(T))
trees: List(List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
})))
tags: List(WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
macroImplArgs: List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
}), WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
original:
scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
})
Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
blackbox typecheck (against pt = (pt.inescn.macros.MacroCore.TaskInfo, (?, ?) => pt.inescn.search.stream.Tasks.Out[?])): (scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
}): (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String]))
undetParam added: type T1
undetParam added: type T2
undetParam added: type A
undetParam inferred: type A as String
undetParam inferred: type T1 as pt.inescn.macros.MacroCore.TaskInfo
undetParam inferred: type T2 as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam inferred: type I as String
undetParam inferred: type O as String
undetParam inferred: type P1 as String
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam added: type I
undetParam added: type O
undetParam added: type P1
undetParam added: type T
undetParam inferred: type T as (String, String) => Either[pt.inescn.utils.ADWError,String]
macroExpand: expander = scala.tools.nsc.typechecker.Macros$DefMacroExpander@7157e2a4, expandee = Apply[1](TypeApply[2](Select[3](Select[4](Select[5](Select[6](Ident[7](pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.TaskMacro#12699), TermName("nameFunc")#12912), List(TypeTree[8]())), List(Block[8](List(), Function[8](List(ValDef[9](Modifiers(PARAM | SYNTHETIC), TermName("ap")#33740, TypeTree[10](), EmptyTree), ValDef[9](Modifiers(PARAM | SYNTHETIC), TermName("i")#33741, TypeTree[10](), EmptyTree)), Apply[11](Ident[12](TermName("concatFunc")#14365), List(Ident[10](TermName("ap")#33740), Ident[10](TermName("i")#33741)))))))
[1] TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))))))
[2] MethodType(List(TermName("a")#36040), TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()))))))))
[3] PolyType(List(TypeName("T")#12970), MethodType(List(TermName("a")#12971), TypeRef(ThisType(scala#25), scala.Tuple2#1339, List(TypeRef(SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.MacroCore#12648), pt.inescn.macros.MacroCore.TaskInfo#12798, List()), TypeRef(NoPrefix, TypeName("T")#12970, List())))))
[4] SingleType(SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642), pt.inescn.macros.TaskMacro#12699)
[5] SingleType(SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618), pt.inescn.macros#6642)
[6] SingleType(SingleType(ThisType(<root>#2), pt#30), pt.inescn#6618)
[7] SingleType(ThisType(<root>#2), pt#30)
[8] TypeRef(ThisType(scala#25), scala.Function2#826, List(TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List()), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))))
[9] NoType
[10] TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())
[11] TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))
[12] MethodType(List(TermName("ap")#31535, TermName("i")#31536), TypeRef(SingleType(SingleType(ThisType(<root>#2), scala#24), scala.package#1823), TypeName("Either")#2275, List(TypeRef(ThisType(pt.inescn.utils#6641), pt.inescn.utils.ADWError#12494, List()), TypeRef(SingleType(TypeRef(ThisType(<root>#2), scala#25, List()), scala.Predef#1355), TypeName("String")#6221, List())))), desugared = ()

This is for the failing T case:

performing macro expansion pt.inescn.macros.TaskMacro.nameFunc[(String, String) => Either[pt.inescn.utils.ADWError,String]]({
  ((ap: String, i: String) => concatFunc(ap, i))
}) at source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-62,offset=1898
context: MacroContext(nameFunc@source-/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala,line-62,offset=1898 +0)
prefix: pt.inescn.macros.TaskMacro
targs: List((String, String) => Either[pt.inescn.utils.ADWError,String])
argss: List(List({
  ((ap: String, i: String) => concatFunc(ap, i))
}))
paramss: List(List(value a))
binding: MacroImplBinding(false,true,pt.inescn.macros.TaskMacro$,namedFuncImpl,List(List(Other), List(Expr), List(Tag(0))),List(T))
trees: List(List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
})))
tags: List(WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
macroImplArgs: List(Expr[Nothing]({
  ((ap: String, i: String) => concatFunc(ap, i))
}), WeakTypeTag[(String, String) => Either[pt.inescn.utils.ADWError,String]])
original:
scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
})
Apply(Select(Ident(scala), TermName("Tuple2")), List(Apply(Ident(TermName("TaskInfo")), List(Literal(Constant("Block(Function)")), Literal(Constant("concatFunc")), Apply(Select(Select(Select(Ident(scala), TermName("collection")), TermName("immutable")), TermName("List")), List(Literal(Constant("ap")), Literal(Constant("i")))))), Block(List(), Function(List(ValDef(Modifiers(PARAM | SYNTHETIC), TermName("ap"), TypeTree(), EmptyTree), ValDef(Modifiers(PARAM | SYNTHETIC), TermName("i"), TypeTree(), EmptyTree)), Apply(Ident(TermName("concatFunc")), List(Ident(TermName("ap")), Ident(TermName("i"))))))))
blackbox typecheck (against pt = (pt.inescn.macros.MacroCore.TaskInfo, (?, ?) => pt.inescn.search.stream.Tasks.Out[?])): (scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
}): (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String]))
undetParam added: type T1
undetParam added: type T2
undetParam added: type A
undetParam inferred: type A as String
undetParam inferred: type T1 as pt.inescn.macros.MacroCore.TaskInfo
undetParam inferred: type T2 as (String, String) => Either[pt.inescn.utils.ADWError,String]
undetParam inferred: type I as String
undetParam inferred: type O as String
undetParam inferred: type P1 as Char
undetParam added: type T
e[0m[e[0me[31merrore[0m] e[0me[0m/home/hmf/IdeaProjects/adw/core/src/main/scala/pt/inescn/scratchpad/Tut.scala:62:52: type mismatch;e[0m
e[0m[e[0me[31merrore[0m] e[0me[0m found   : (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String])e[0m
e[0m[e[0me[31merrore[0m] e[0me[0m required: (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => pt.inescn.search.stream.Tasks.Out[String])e[0m
e[0m[e[0me[31merrore[0m] e[0me[0m    (which expands to)  (pt.inescn.macros.MacroCore.TaskInfo, (Char, String) => scala.util.Either[pt.inescn.utils.ADWError,String])e[0m
e[0m[e[0me[31merrore[0m] e[0me[0m    val concat0 =  pt.inescn.search.stream.Tasks.T(concatFunc _, ap)e[0m
e[0m[e[0me[31merrore[0m] e[0me[0m                                                   ^e[0m

EDIT: trying to see were the difference are. The blackbox typecheck are not the same. In the case T1 that succeeds we have:

blackbox typecheck (against pt = ?): (scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
}): (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String]))

but for the failing T we have:

blackbox typecheck (against pt = (pt.inescn.macros.MacroCore.TaskInfo, (?, ?) => pt.inescn.search.stream.Tasks.Out[?])): (scala.Tuple2(TaskInfo("Block(Function)", "concatFunc", scala.collection.immutable.List("ap", "i")), {
  ((ap: String, i: String) => concatFunc(ap, i))
}): (pt.inescn.macros.MacroCore.TaskInfo, (String, String) => Either[pt.inescn.utils.ADWError,String]))

Although different the types seem to match. And their is not Char to be found in the case of T1 function. The parameters that follow (T1,T2,A,I,O) all have the same inferred types. However P1 is different.

Maybe this can help find the problem?