Skip to content

Support contextual dependent extensions #9530

Closed
@nicolasstucki

Description

@nicolasstucki

Minimized example

We should support

trait Scope:
  type Expr

extension (using s: Scope)(expr: s.Expr)
  def show = "expr"

def f(using s: Scope)(s.Expr) = s.show

or the less performant

trait Scope:
  type Expr

given (using s: Scope) as AnyRef:
  extension (expr: s.Expr)
    def show = "expr"

def f(using s: Scope)(expr: s.Expr) = expr.show

Expectation

One of those should be supported to be able to encode

implicit class Ops(using s: Scope)(e: s.Expr):
  def show = "expr"

which does work and has several use cases.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions