summaryrefslogtreecommitdiff
path: root/test/files/run/t7817-tree-gen.check
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-06 16:30:09 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-09 23:32:24 +0200
commitb255617a6b56af810a3f065ccb887a2b4d36e631 (patch)
treedbf5ff9c1b22cba7a24bef53bae6a7a791815295 /test/files/run/t7817-tree-gen.check
parent292134a4ab5a10052046a722c0b3192b3bfabae7 (diff)
downloadscala-b255617a6b56af810a3f065ccb887a2b4d36e631.tar.gz
scala-b255617a6b56af810a3f065ccb887a2b4d36e631.tar.bz2
scala-b255617a6b56af810a3f065ccb887a2b4d36e631.zip
SI-7817 Fix regression in structural types
Calls to structural types are converted to reflective calls in the `cleanup` phase, which, along with `mixin`, does its work after `flatten`. `Symbol#owner` behaves in a phase dependent manner; after flatten the owner of lifted class is given as the enclosing package. Except when they're not. `ModuleSymbol`s representing an object nested inside a class are viewed dually as modules *and* methods (see the comments on `isModuleNotMethod` for some background). When it comes time to flatten, we're presented with a quandary: the method must clearly stay owned by the enclosing class, but surely the lifted module should be owned by the enclosing package, to have the same owner as its associated module class. The `method` nature of this symbol seems to win: override def owner = { if (Statistics.hotEnabled) Statistics.incCounter(ownerCount) if (!isMethod && needsFlatClasses) rawowner.owner else rawowner This wrinkle leads to a wrong turn in `TreeGen#mkAttributedRef`, which incorrectly rewrites `REF(O)` to `p1.`package`.O`. It seems this problem has gone unnoticed because the tree emitted referred to a static symbol (the reflection cache for structural types), and the backend simply elided the qualifier `p1.package`. A recent change to the backend makes it more conservative about dropping qualifiers on the floor, and it started emitting a reference to a package object that doesn't exist. This commit despairingly checks `isDefinedInPackage` of both the module *and* the module class. The test cases from the previous commit illustrated the status quo, and this commit updates the joint compilation test with the bug fix. A new test is to show that the symptom (structural type crash) is now fixed.
Diffstat (limited to 'test/files/run/t7817-tree-gen.check')
-rw-r--r--test/files/run/t7817-tree-gen.check8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/files/run/t7817-tree-gen.check b/test/files/run/t7817-tree-gen.check
index e5fd6a10a0..4ed4b0d94a 100644
--- a/test/files/run/t7817-tree-gen.check
+++ b/test/files/run/t7817-tree-gen.check
@@ -11,8 +11,8 @@ Joint Compilation:
erasure [ O] - O.this
posterasure [ O] - C.this.O()
flatten [ O] - C.this.O()
- mixin [ O] !!! test.`package`.O()
- cleanup [ O] !!! test.`package`.O()
+ mixin [ O] - test.O()
+ cleanup [ O] - test.O()
typer [ P] - P.this
pickler [ P] - P.this
@@ -63,8 +63,8 @@ Separate Compilation:
erasure [ O] - O.this
posterasure [ O] - C.this.O()
flatten [ O] - C.this.O()
- mixin [ O] !!! testSep.`package`.O()
- cleanup [ O] !!! testSep.`package`.O()
+ mixin [ O] - testSep.O()
+ cleanup [ O] - testSep.O()
typer [ P] - P.this
pickler [ P] - P.this