Skip to content

Commit 1211c9b

Browse files
authored
Merge pull request #1146 from milessabin/revert-1136-lazy-impl
Revert "Fix Lazy implicit resolution with type parameters"
2 parents e71347b + 45fe68c commit 1211c9b

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

core/src/main/scala/shapeless/lazy.scala

+6-10
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,17 @@ class LazyMacros(val c: whitebox.Context) extends CaseClassMacros with OpenImpli
293293

294294
private var current = Option.empty[State]
295295

296-
private def typeParamsToWildcards(tpe: Type): Type = tpe.map { t =>
297-
val sym = t.typeSymbol
298-
if (sym.isParameter) boundedWildcardType(sym.info.asInstanceOf[TypeBounds]) else t
299-
}
300-
301296
def resolveInstance(state: State)(tpe: Type): Option[(State, Tree)] = {
302297
val former = State.current
303298
State.current = Some(state)
304299
val (state0, tree) =
305300
try {
306-
val tree = c.inferImplicitValue(tpe, silent = true) orElse c.inferImplicitValue(typeParamsToWildcards(tpe), silent = true)
307-
if (tree.isEmpty) {
308-
tpe.typeSymbol.annotations
309-
.find(_.tree.tpe =:= typeOf[_root_.scala.annotation.implicitNotFound])
310-
.foreach(_ => setAnnotation(implicitNotFoundMessage(c)(tpe)))
301+
val tree = c.inferImplicitValue(tpe, silent = true)
302+
if(tree.isEmpty) {
303+
tpe.typeSymbol.annotations.
304+
find(_.tree.tpe =:= typeOf[_root_.scala.annotation.implicitNotFound]).foreach { _ =>
305+
setAnnotation(implicitNotFoundMessage(c)(tpe))
306+
}
311307
}
312308
(State.current.get, tree)
313309
} finally {

core/src/test/scala/shapeless/lazy.scala

-24
Original file line numberDiff line numberDiff line change
@@ -334,27 +334,3 @@ class LazyStrictTests {
334334
implicitly[Strict[Readable[Id]]]
335335
}
336336
}
337-
338-
object TestLazyWithTypeParametersAndBounds {
339-
trait Foo
340-
case class BarFoo(i: Int) extends Foo
341-
342-
trait Fooer[Tpe, FooTpe] {
343-
def makeFoo(obj: Tpe): FooTpe
344-
}
345-
346-
object Fooer {
347-
implicit val barFooer: Fooer[Int, BarFoo] = null
348-
}
349-
350-
class Finder[Tpe] {
351-
def find[F <: Foo](implicit fooer: Fooer[Tpe, F]) = fooer
352-
def findLazy[F <: Foo](implicit fooer: Lazy[Fooer[Tpe, F]]) = fooer
353-
def findNoBounds[F](implicit fooer: Lazy[Fooer[Tpe, F]]) = fooer
354-
}
355-
356-
val intFinder = new Finder[Int]
357-
intFinder.find
358-
intFinder.findLazy
359-
intFinder.findNoBounds
360-
}

0 commit comments

Comments
 (0)