diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-13 12:45:46 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-14 22:44:25 +0100 |
commit | e57af7dae72cae7d071f848edaf1fdbe32939ed8 (patch) | |
tree | 2ede778dc5115d77a7191b1d2899a92020ab0df9 /test/files/run/t8133/A_1.scala | |
parent | e089cafb5fd02e2457bafde3252da3a771d3180e (diff) | |
download | scala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.tar.gz scala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.tar.bz2 scala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.zip |
SI-8133 Fix regression with package objects, overloading
Regressed in f5c336d56, a refactoring of `typedIdent`. In that
commit, an (ostensibly) accidental change arrived, equivalent to:
- val pre1 = if (qual == EmptyTree) NoPrefix else if (sym.isTopLevel) sym.owner.thisType else qual.tpe
+ val pre1 = if (sym.isTopLevel) sym.owner.thisType else if (qual == EmptyTree) NoPrefix else qual.tpe
Here, `qual` is a tree returned in the successful result of
`Context#lookup`.
This change itself looks innocuous (top level symbols can be prefixed
with a qualifier or not, right?), but it exposed us to a bug in
`makeAccessible`. It is responsible for rewriting, e.g,
`scala.List` to `scala.package.List`. It has a few cases, but one
of them relies relies on typechecking `Ident(nme.PACKAGE)`, and
hoping that it will bind to the right place. That's fraught with
danger, and breaks in the enclosed tests.
This commit binds that Ident symbolically, and in the process
factors a tiny bit of code in common with `TreeGen`. (More work
is still needed here!)
In the next commit, I'm going to revert the change to `pre1`. That
would have also fixed the regression, albeit symptomatically.
Diffstat (limited to 'test/files/run/t8133/A_1.scala')
-rw-r--r-- | test/files/run/t8133/A_1.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/files/run/t8133/A_1.scala b/test/files/run/t8133/A_1.scala new file mode 100644 index 0000000000..a2836cdb3a --- /dev/null +++ b/test/files/run/t8133/A_1.scala @@ -0,0 +1,5 @@ +// a.scala +package object pkg { + class AnyOps(val x: Any) extends AnyVal + def AnyOps(x: Any) = new AnyOps(x) +} |