Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ object Contexts {
*
* - as owner: The primary constructor of the class
* - as outer context: The context enclosing the class context
* - as scope: type parameters, the parameter accessors, and
* the context bound companions in the class context,
* - as scope: type parameters, the parameter accessors,
* the dummy capture parameters and the context bound companions in the class context,
*
* The reasons for this peculiar choice of attributes are as follows:
*
Expand All @@ -420,7 +420,7 @@ object Contexts {
def superCallContext: Context =
val locals = owner.typeParams
++ owner.asClass.unforcedDecls.filter: sym =>
sym.is(ParamAccessor) || sym.isContextBoundCompanion
sym.is(ParamAccessor) || sym.isContextBoundCompanion || sym.isDummyCaptureParam
superOrThisCallContext(owner.primaryConstructor, newScopeWith(locals*))

/** The context for the arguments of a this(...) constructor call.
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/SymUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SymUtils:
self.is(Synthetic) && self.infoOrCompleter.typeSymbol == defn.CBCompanion

def isDummyCaptureParam(using Context): Boolean =
self.isAllOf(CaptureParam) && !(self.isClass || self.is(Method))
self.is(PhantomSymbol) && self.infoOrCompleter.typeSymbol != defn.CBCompanion

/** Is this a case class for which a product mirror is generated?
* Excluded are value classes, abstract classes and case classes with more than one
Expand Down
10 changes: 10 additions & 0 deletions tests/pos-custom-args/captures/i23737.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import language.experimental.captureChecking

class C

trait A[T]

trait B[CC^] extends A[C^{CC}] // error: CC not found

trait D[CC^]:
val x: Object^{CC} = ???
Loading