Skip to content

Incorrect phase consistency check related to inner classes #5954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
liufengyun opened this issue Feb 20, 2019 · 1 comment
Closed

Incorrect phase consistency check related to inner classes #5954

liufengyun opened this issue Feb 20, 2019 · 1 comment
Assignees

Comments

@liufengyun
Copy link
Contributor

liufengyun commented Feb 20, 2019

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
@nicolasstucki
Copy link
Contributor

The first one should clearly pass the checks. Though the second one is capturing a within the type which means the error should be on a rather than MatcherFactory1.this.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 21, 2019
liufengyun added a commit that referenced this issue Feb 21, 2019
Fix #5954: Do not check prefix for non locally defined types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants