Skip to content

Commit

Permalink
Backport "fix(#i18645): overload ext method body in braces didn't com…
Browse files Browse the repository at this point in the history
…pile" to LTS (#20916)

Backports #19651 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur committed Jul 2, 2024
2 parents 0155d65 + b49f016 commit 6ccc786
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ object ProtoTypes {
case closureDef(mdef) => hasInnerErrors(mdef.rhs)
case _ =>
t.existsSubTree { t1 =>
if t1.typeOpt.isError && t1.span.toSynthetic != t.span.toSynthetic then
if t1.typeOpt.isError
&& t.span.toSynthetic != t1.span.toSynthetic
&& t.typeOpt != t1.typeOpt then
typr.println(i"error subtree $t1 of $t with ${t1.typeOpt}, spans = ${t1.span}, ${t.span}")
true
else
Expand Down
16 changes: 16 additions & 0 deletions tests/pos/i18645.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
trait Printable {
def pprint(v: () => String): Unit = {
println(v())
}
}

extension (ctx: Printable)
def pprint(f: () => Int): Unit = {
ctx.pprint(() => f().toString)
}

val x = new Printable {}

def test =
x.pprint(() => ( 234 ))
x.pprint(() => { 123 })

0 comments on commit 6ccc786

Please sign in to comment.