Skip to content

Commit f04d285

Browse files
committed
Add comment for path-dependent limitation
1 parent 9015611 commit f04d285

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,7 @@ class CheckCaptures extends Recheck, SymTransformer:
494494

495495
val selType = recheckSelection(tree, qualType, name, disambiguate)
496496
val selWiden = selType.widen
497-
def isStableSel = selType match
498-
case selType: NamedType => selType.symbol.isStableMember
499-
case _ => false
500-
497+
501498
if pt == LhsProto
502499
|| qualType.isBoxedCapturing
503500
|| selType.isTrackableRef

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
518518
info match
519519
case mt: MethodOrPoly =>
520520
val psyms = psymss.head
521+
// TODO: the substitution does not work for param-dependent method types.
522+
// For example, `(x: T, y: x.f.type) => Unit`. In this case, when we
523+
// substitute `x.f.type`, `x` becomes a `TermParamRef`. But the new method
524+
// type is still under initialization and `paramInfos` is still `null`,
525+
// so the new `NamedType` will not have a denoation.
521526
mt.companion(mt.paramNames)(
522527
mt1 =>
523528
if !paramSignatureChanges && !mt.isParamDependent && prevLambdas.isEmpty then

tests/neg-custom-args/captures/path-connection.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class ReaderProxy(tracked val r: Reader^) extends Reader:
1919
class SenderProxy(tracked val s: Sender^) extends Sender:
2020
def send(msg: String) = s.send("(Proxy) " + msg)
2121

22+
// TODO: We have to put `c` in the different argument list to make it work.
23+
// See the comments in `integrateRT`.
2224
def testConnection(c: Connection^)(
2325
handle1: Reader^{c.readOnly} => String,
2426
handle2: Sender^{c} => Unit,

0 commit comments

Comments
 (0)