Skip to content

Commit 98ad63e

Browse files
committed
Account for capture dependencies when substituting
1 parent 22b2259 commit 98ad63e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3880,7 +3880,8 @@ object Types {
38803880
/** Does one of the parameter types contain references to earlier parameters
38813881
* of this method type which cannot be eliminated by de-aliasing?
38823882
*/
3883-
def isParamDependent(using Context): Boolean = paramDependencyStatus == TrueDeps
3883+
def isParamDependent(using Context): Boolean =
3884+
paramDependencyStatus == TrueDeps || paramDependencyStatus == CaptureDeps
38843885

38853886
/** Is there a dependency involving a reference in a capture set, but
38863887
* otherwise no true result dependency?
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import language.experimental.captureChecking
2+
3+
trait Foo[T]
4+
def test(): Unit =
5+
val a: Foo[Int]^ = ???
6+
val useA: () ->{a} Unit = ???
7+
def foo[X](x: Foo[X]^, op: () ->{x} Unit): Unit = ???
8+
foo(a, useA)

0 commit comments

Comments
 (0)