Skip to content

Use supercall context when calling inserted super traits #12003

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
Apr 13, 2021
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
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ class Typer extends Namer
var added: Tree = TypeTree(parent).withSpan(cdef.nameSpan.focus)
if psym.is(Trait) && psym.primaryConstructor.info.takesImplicitParams then
// classes get a constructor separately using a different context
added = ensureConstrCall(cls, added)
added = ensureConstrCall(cls, added)(using superCtx)
added :: parentTrees(parents1, ptrees)
case _ =>
ptrees
Expand Down
1 change: 1 addition & 0 deletions tests/run/i11966.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
17 changes: 17 additions & 0 deletions tests/run/i11966.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
trait A[T]:
def f: T

trait B[T: A]:
println(summon[A[T]].f)

trait C[T: A] extends B[T]

given a1: A[Int] with
def f = 1

class D extends C[Int]:
given a2: A[Int] with
def f = 2

@main def Test = D()