Skip to content

Commit

Permalink
Add comment for path-dependent limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Sep 19, 2024
1 parent 9015611 commit f04d285
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,7 @@ class CheckCaptures extends Recheck, SymTransformer:

val selType = recheckSelection(tree, qualType, name, disambiguate)
val selWiden = selType.widen
def isStableSel = selType match
case selType: NamedType => selType.symbol.isStableMember
case _ => false


if pt == LhsProto
|| qualType.isBoxedCapturing
|| selType.isTrackableRef
Expand Down
5 changes: 5 additions & 0 deletions compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
info match
case mt: MethodOrPoly =>
val psyms = psymss.head
// TODO: the substitution does not work for param-dependent method types.
// For example, `(x: T, y: x.f.type) => Unit`. In this case, when we
// substitute `x.f.type`, `x` becomes a `TermParamRef`. But the new method
// type is still under initialization and `paramInfos` is still `null`,
// so the new `NamedType` will not have a denoation.
mt.companion(mt.paramNames)(
mt1 =>
if !paramSignatureChanges && !mt.isParamDependent && prevLambdas.isEmpty then
Expand Down
2 changes: 2 additions & 0 deletions tests/neg-custom-args/captures/path-connection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ReaderProxy(tracked val r: Reader^) extends Reader:
class SenderProxy(tracked val s: Sender^) extends Sender:
def send(msg: String) = s.send("(Proxy) " + msg)

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

0 comments on commit f04d285

Please sign in to comment.