Skip to content

Singleton type of context function #16488

Closed
@prolativ

Description

@prolativ

Compiler version

3.2.1

Minimized code

trait Ctx
val f: Ctx ?=> Int = ???
def g: f.type = f

Output

-- [E172] Type Error: ----------------------------------------------------------
3 |def g: f.type = f
  |        ^
  |    No given instance of type Ctx was found for parameter of (Ctx) ?=> Int
-- [E172] Type Error: ----------------------------------------------------------
3 |def g: f.type = f
  |                 ^
  |    No given instance of type Ctx was found for parameter of (Ctx) ?=> Int

Expectation

This should compile as it does for non-singleton context function types, e.g.

trait Ctx
val f: Ctx ?=> Int = ???
def g: Ctx ?=> Int = f

and singleton non-contextual function types, e.g.

trait Ctx
val f: Ctx => Int = ???
def g: f.type = f

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions