diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 57aab549cfd5..3c3ddbe3fff1 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2206,7 +2206,11 @@ class Typer extends Namer /** Interpolate and simplify the type of the given tree. */ protected def simplify(tree: Tree, pt: Type, locked: TypeVars)(implicit ctx: Context): tree.type = { - if (!tree.denot.isOverloaded) // for overloaded trees: resolve overloading before simplifying + if (!tree.denot.isOverloaded && + // for overloaded trees: resolve overloading before simplifying + !tree.isInstanceOf[Applications.IntegratedTypeArgs] + // don't interpolate in the middle of an extension method application + ) if (!tree.tpe.widen.isInstanceOf[MethodOrPoly] // wait with simplifying until method is fully applied || tree.isDef) // ... unless tree is a definition { diff --git a/tests/pos/i6734.scala b/tests/pos/i6734.scala new file mode 100644 index 000000000000..c796a867bb92 --- /dev/null +++ b/tests/pos/i6734.scala @@ -0,0 +1,11 @@ +object Bug { + + def (ab: (A, B)) pipe2[A, B, Z](f: (A, B) => Z): Z = f(ab._1, ab._2) + + def (a: A) leftErr[A, B](b: B): A = (a, b).pipe2((a, b) => a) //Did not compile before. + def (a: A) leftOk1[A, B](b: B): A = Tuple2(a, b).pipe2((a, b) => a) //Compiles + def (a: A) leftOk2[A, B](b: B): A = { + val t = (a, b) + t.pipe2((a, b) => a) //Compiles + } +}