File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
compiler/src/dotty/tools/dotc/core
tests/pos-custom-args/captures Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -402,8 +402,8 @@ object Contexts {
402402 *
403403 * - as owner: The primary constructor of the class
404404 * - as outer context: The context enclosing the class context
405- * - as scope: type parameters, the parameter accessors, and
406- * the context bound companions in the class context,
405+ * - as scope: type parameters, the parameter accessors,
406+ * the dummy capture parameters and the context bound companions in the class context,
407407 *
408408 * The reasons for this peculiar choice of attributes are as follows:
409409 *
@@ -420,7 +420,7 @@ object Contexts {
420420 def superCallContext : Context =
421421 val locals = owner.typeParams
422422 ++ owner.asClass.unforcedDecls.filter: sym =>
423- sym.is(ParamAccessor ) || sym.isContextBoundCompanion
423+ sym.is(ParamAccessor ) || sym.isContextBoundCompanion || sym.isDummyCaptureParam
424424 superOrThisCallContext(owner.primaryConstructor, newScopeWith(locals* ))
425425
426426 /** The context for the arguments of a this(...) constructor call.
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class SymUtils:
9191 self.is(Synthetic ) && self.infoOrCompleter.typeSymbol == defn.CBCompanion
9292
9393 def isDummyCaptureParam (using Context ): Boolean =
94- self.isAllOf( CaptureParam ) && ! ( self.isClass || self.is( Method ))
94+ self.is( PhantomSymbol ) && self.infoOrCompleter.typeSymbol != defn. CBCompanion
9595
9696 /** Is this a case class for which a product mirror is generated?
9797 * Excluded are value classes, abstract classes and case classes with more than one
Original file line number Diff line number Diff line change 1+ import language .experimental .captureChecking
2+
3+ class C
4+
5+ trait A [T ]
6+
7+ trait B [CC ^ ] extends A [C ^ {CC }] // error: CC not found
8+
9+ trait D [CC ^ ]:
10+ val x : Object ^ {CC } = ???
11+
12+ def f (c : C ^ ) =
13+ val b = new B [{c}] {}
14+ val a : A [C ^ {c}] = b
You can’t perform that action at this time.
0 commit comments