Skip to content

Fix #8198: Handle trees with TypedSplice #8200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2020
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
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,9 @@ trait Applications extends Compatibility {
* { val xs = es; e' = e' + args }
*/
def typedOpAssign(implicit ctx: Context): Tree = {
val Apply(Select(lhs, name), rhss) = tree
val lhs1 = typedExpr(lhs)
val (lhs1, name, rhss) = tree match
case Apply(Select(lhs, name), rhss) => (typedExpr(lhs), name, rhss)
case Apply(untpd.TypedSplice(Select(lhs1, name)), rhss) => (lhs1, name, rhss)
val liftedDefs = new mutable.ListBuffer[Tree]
val lhs2 = untpd.TypedSplice(LiftComplex.liftAssigned(liftedDefs, lhs1))
val assign = untpd.Assign(lhs2,
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i8198.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
trait Eq[A] {
def (x: A) === (y: A): Boolean
def (x: A) /== (y: A): Boolean = !(x === y)
}

case class Id[T](id: T)

given idEq[A](given eqA: Eq[A]): Eq[Id[A]] = new {
def (i1: Id[A]) === (i2: Id[A]) = !(i1.id /== i2.id)
}