Skip to content

Commit b0aac8c

Browse files
authored
Merge pull request #8200 from dotty-staging/fix-#8198
Fix #8198: Handle trees with TypedSplice
2 parents 46aec62 + 0dba636 commit b0aac8c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,9 @@ trait Applications extends Compatibility {
948948
* { val xs = es; e' = e' + args }
949949
*/
950950
def typedOpAssign(implicit ctx: Context): Tree = {
951-
val Apply(Select(lhs, name), rhss) = tree
952-
val lhs1 = typedExpr(lhs)
951+
val (lhs1, name, rhss) = tree match
952+
case Apply(Select(lhs, name), rhss) => (typedExpr(lhs), name, rhss)
953+
case Apply(untpd.TypedSplice(Select(lhs1, name)), rhss) => (lhs1, name, rhss)
953954
val liftedDefs = new mutable.ListBuffer[Tree]
954955
val lhs2 = untpd.TypedSplice(LiftComplex.liftAssigned(liftedDefs, lhs1))
955956
val assign = untpd.Assign(lhs2,

tests/pos/i8198.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trait Eq[A] {
2+
def (x: A) === (y: A): Boolean
3+
def (x: A) /== (y: A): Boolean = !(x === y)
4+
}
5+
6+
case class Id[T](id: T)
7+
8+
given idEq[A](given eqA: Eq[A]): Eq[Id[A]] = new {
9+
def (i1: Id[A]) === (i2: Id[A]) = !(i1.id /== i2.id)
10+
}

0 commit comments

Comments
 (0)