Skip to content

Commit f053bfb

Browse files
committed
Harden inferView
Should not be attempted if argument does not have a value type. Test case is this one. I don't want to include it in the rgeression tests though because it looks too noisy (i.e. we would likely get spurious failures for tiny changes in the future). class i0 { type Ordering[i1, i2] = (=> i3[i1]) def i4[i2, i3](i5: i1): i4[Any] // error i8 += i14 { type i4[+i9] = i5 def i7: Int = i6(5) class i9[i10 <: i16 <: i4[_], i12](val i14: i11[_], i4: i11) { // error def i16[i14 >: i1]: i0 = ??? implicit def i13[i4](i5: (=> i6)): i1[i6] // error type i13[i7] = i13[i7] def i8[+i1[+i2] <: i0[i1]]](i9: => ii5[i7]): i7[i5] = sys.error(); // error // error def i10(i11: i4[i10.i4])(implicit i8: i0[i6#i0]) = i4 * i7 i5 i4! this match { case i14(i9) => 3 } } class i10 { type i13 = i10.i8 val i11 = var i21 = case class Tuple1(i3: i1, i4: i4, i6) } (new i10(i13)) } } package i1.i0 object i12 { def i9(i10: i1)(implicit i9: i8[Boolean]) = implicitly[i9](i10: Any, i4, i9) {} case class i9[i14[i2]](i16: i11[i8[i2]]) extends i10[i4, i14] { def this(i11: i12) = { val i5 = new i5[Int, Int] } }
1 parent 7058075 commit f053bfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,7 @@ class Typer extends Namer
24472447
if (isFullyDefined(wtp, force = ForceDegree.all) &&
24482448
ctx.typerState.constraint.ne(prevConstraint)) readapt(tree)
24492449
else err.typeMismatch(tree, pt, failure)
2450-
if (ctx.mode.is(Mode.ImplicitsEnabled))
2450+
if (ctx.mode.is(Mode.ImplicitsEnabled) && tree.typeOpt.isValueType)
24512451
inferView(tree, pt) match {
24522452
case SearchSuccess(inferred, _, _) =>
24532453
readapt(inferred)(ctx.retractMode(Mode.ImplicitsEnabled))

0 commit comments

Comments
 (0)