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 {
402
402
*
403
403
* - as owner: The primary constructor of the class
404
404
* - 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,
407
407
*
408
408
* The reasons for this peculiar choice of attributes are as follows:
409
409
*
@@ -420,7 +420,7 @@ object Contexts {
420
420
def superCallContext : Context =
421
421
val locals = owner.typeParams
422
422
++ owner.asClass.unforcedDecls.filter: sym =>
423
- sym.is(ParamAccessor ) || sym.isContextBoundCompanion
423
+ sym.is(ParamAccessor ) || sym.isContextBoundCompanion || sym.isDummyCaptureParam
424
424
superOrThisCallContext(owner.primaryConstructor, newScopeWith(locals* ))
425
425
426
426
/** 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:
91
91
self.is(Synthetic ) && self.infoOrCompleter.typeSymbol == defn.CBCompanion
92
92
93
93
def isDummyCaptureParam (using Context ): Boolean =
94
- self.isAllOf( CaptureParam ) && ! ( self.isClass || self.is( Method ))
94
+ self.is( PhantomSymbol ) && self.infoOrCompleter.typeSymbol != defn. CBCompanion
95
95
96
96
/** Is this a case class for which a product mirror is generated?
97
97
* 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