Skip to content
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

TreeChecker is too strict when checking symbol references #8282

Open
scabug opened this issue Feb 14, 2014 · 2 comments
Open

TreeChecker is too strict when checking symbol references #8282

scabug opened this issue Feb 14, 2014 · 2 comments
Labels

Comments

@scabug
Copy link

scabug commented Feb 14, 2014

For higher-kinded types:

$ cat x.scala 
import language.higherKinds

trait Dist[Z] { self =>
  def sample[CC[A] <: Iterable[A]](n: Int): CC[Z] =
    ???
}

$ scalac x.scala -Ycheck:typer
[Now checking: typer]
[check: typer] The symbol, tpe or info of tree `(def sample[CC[A >: Nothing <: Any] >: [A]Nothing <: [A]Iterable[A]](n: Int): CC[Z] = scala.this.Predef.???) : [CC[A] <: Iterable[A]](n: Int)CC[Z]` refers to a out-of-scope symbol, type A. tree.symbol.ownerChain: method sample, trait Dist, package <empty>, package <root>
warning: TreeCheckers detected non-compliant trees in x.scala
one warning found

And one more example in the comments.

@scabug
Copy link
Author

scabug commented Feb 14, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8282?orig=1
Reporter: @VladUreche
Affected Versions: 2.10.4-RC3

@scabug
Copy link
Author

scabug commented Feb 3, 2015

@VladUreche said (edited on Feb 3, 2015 2:20:31 PM UTC):
Another example:

$ cat gh-bug-104.scala 
package miniboxing.tests.compile.bug104

class D[S] {
  def bar(s: S) = {
    class Z
    def foo = new Z
    ()
  }
}

$ scalac gh-bug-104.scala -Ycheck:typer
[Now checking: typer]
warning: [check: typer]
Out of scope symbol reference {
      tree  DefDef               def foo: Z = new Z()
  position  OffsetPosition       gh-bug-104.scala:6
  with sym  MethodSymbol         def foo: Z                               in  method bar -> class D -> package bug104
   encl(1)  MethodSymbol         def bar(s: S): Unit                      in  class D -> package bug104
   encl(2)  ClassSymbol          D: miniboxing.tests.compile.bug104.D[S]  in  package bug104
    ref to  ClassSymbol          Z ()                                     in  method bar -> class D -> package bug104
}
one warning found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant