milessabin/shapeless — pull request #232 by travisbrown (2014-09-17 22:52:18+00:00)
Title: Fixed hygiene bug in witness generation.

Here's a quick example:

``` scala
case class Foo(i: Int)

object Bar {
import shapeless._
def firstKeyName[K <: Symbol, V, T <: HList](l: record.FieldType[K, V] :: T)(implicit
witness: Witness.Aux[K]
): String = witness.value.name
}
```

And then:

``` scala
scala> Bar.firstKeyName(shapeless.LabelledGeneric[Foo].to(Foo(1)))
:11: shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[Symbol with shapeless.tag.Tagged[String("i")]] because:
hasMatchingSymbol reported error: not found: type Witness
Bar.firstKeyName(shapeless.LabelledGeneric[Foo].to(Foo(1)))
^
:11: error: could not find implicit value for parameter witness: shapeless.Witness.Aux[Symbol with shapeless.tag.Tagged[String("i")]]
Bar.firstKeyName(shapeless.LabelledGeneric[Foo].to(Foo(1)))
^
```

But:

``` scala
scala> import shapeless._
import shapeless._

scala> Bar.firstKeyName(shapeless.LabelledGeneric[Foo].to(Foo(1)))
res1: String = i
```

Adding the full path from `_root_` in `mkWitness` fixes the issue.