Skip to content

Level checking failing with path dependent types #13376

Closed
@nicolasstucki

Description

@nicolasstucki

Minimization:

import scala.quoted.*
trait C:
  type T
  def foo: T
inline def makro(inline x: C): x.T = ${ impl[x.type]('x) }
def impl[CC <: C](xp: Expr[CC])(using Quotes): Expr[CC#T] = '{ $xp.foo }
-- Error: Test.scala:5:45 ------------------------------------------------------
5 |inline def makro(inline x: C): x.T = ${ impl[x.type]('x) }
  |                                             ^
  |                           access to parameter x from wrong staging level:
  |                            - the definition is at level 0,
  |                            - but the access is at level -1.
-- Error: Test.scala:5:53 ------------------------------------------------------
5 |inline def makro(inline x: C): x.T = ${ impl[x.type]('x) }
  |                                                     ^
  |                           access to parameter x from wrong staging level:
  |                            - the definition is at level 0,
  |                            - but the access is at level -1.

(only the first error shows if the [x.type] argument left to inference)

Originally posted by @lrytz in sirthias/parboiled2#274 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions