Skip to content

Commit

Permalink
Account for capture dependencies when substituting
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed May 16, 2023
1 parent 22b2259 commit 98ad63e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3880,7 +3880,8 @@ object Types {
/** Does one of the parameter types contain references to earlier parameters
* of this method type which cannot be eliminated by de-aliasing?
*/
def isParamDependent(using Context): Boolean = paramDependencyStatus == TrueDeps
def isParamDependent(using Context): Boolean =
paramDependencyStatus == TrueDeps || paramDependencyStatus == CaptureDeps

/** Is there a dependency involving a reference in a capture set, but
* otherwise no true result dependency?
Expand Down
8 changes: 8 additions & 0 deletions tests/pos-custom-args/captures/cc-dep-param.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import language.experimental.captureChecking

trait Foo[T]
def test(): Unit =
val a: Foo[Int]^ = ???
val useA: () ->{a} Unit = ???
def foo[X](x: Foo[X]^, op: () ->{x} Unit): Unit = ???
foo(a, useA)

0 comments on commit 98ad63e

Please sign in to comment.