Skip to content

Function classes fail capture checking #18857

Closed
@Linyxus

Description

@Linyxus

Compiler version

main

Minimized code

import language.experimental.captureChecking

val x = new (Int => Unit) {
  def apply(x: Int): Unit = ()
}

Output

-- [E007] Type Mismatch Error: issues/cc-classes.scala:5:1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5 |}
  | ^
  | Found:    Object with (Int => Unit) {...}^?
  | Required: (x$0: Int) ->? Unit
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

It should compile.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions