Skip to content

Wrong capture checking result with path #20481

Open
@noti0na1

Description

@noti0na1

Compiler version

3.4.2
3.5 nightly

Minimized code

import language.experimental.captureChecking

class A:
  val b: A = this

def test(a: A^, c: AnyRef^) =
  val c1: A^{c} = a
  val c2: A^{c} = a.b

Output

> scala-cli compile -S 3.4 Stest.scala
Compiling project (Scala 3.4.2, JVM (21))
[error] ./Stest.scala:249:19
[error] Found:    (a : A^)
[error] Required: A^{c}
[error]   val c1: A^{c} = a
[error]                   ^
Error compiling project (Scala 3.4.2, JVM (21))
Compilation failed

Expectation

a.b should capture a, and both c1 and c2 should produce errors.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions