Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
11 changes: 11 additions & 0 deletions tests/pos/i6734.scala
Original file line number Diff line number Diff line change
@@ -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
}
}