Skip to content

Incorrect phase consistency check related to inner classes #5954

Closed
@liufengyun

Description

@liufengyun

The following code used to type check, but does not compile after #5763.

abstract class MatcherFactory1 {
  class AndNotWord
}

object MatcherFactory1 {
  import scala.quoted._
  import scala.tasty._

  def impl(self: Expr[MatcherFactory1#AndNotWord])(implicit refl: Reflection) =
    '{ ~self }

  def impl2(a: MatcherFactory1)(self: Expr[a.AndNotWord])(implicit refl: Reflection) =
    '{ ~self }
}

Error message:

-- Error: examples/MatcherFactory1.scala:10:7 ----------------------------------
10 |    '{ ~self }
   |       ^^^^^
   |       access to MatcherFactory1.this from wrong staging level:
   |        - the definition is at level 0,
   |        - but the access is at level 1.
-- Error: examples/MatcherFactory1.scala:13:7 ----------------------------------
13 |    '{ ~self }
   |       ^^^^^
   |       access to MatcherFactory1.this from wrong staging level:
   |        - the definition is at level 0,
   |        - but the access is at level 1.
two errors found

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions