diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-19 10:32:30 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-19 10:32:30 -0800 |
commit | b10cd2d50685602238277eceb2d6c22943839cca (patch) | |
tree | 6c7b3becf5860115b49dc3cca4e4245d20924752 | |
parent | 1beb44886c1f355e16f6024cfb66c54843530e2e (diff) | |
parent | 823d77947e7f6502905cfbafee396fad0a908ede (diff) | |
download | scala-b10cd2d50685602238277eceb2d6c22943839cca.tar.gz scala-b10cd2d50685602238277eceb2d6c22943839cca.tar.bz2 scala-b10cd2d50685602238277eceb2d6c22943839cca.zip |
Merge pull request #1626 from paulp/issue/6357
Fix for SI-6357, cycle with value classes.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 | ||||
-rw-r--r-- | test/files/neg/t6357.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6357.scala | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 04fb69671e..28bed0f1bf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1315,7 +1315,8 @@ trait Namers extends MethodSynthesis { if (clazz.isDerivedValueClass) { log("Ensuring companion for derived value class " + name + " at " + cdef.pos.show) clazz setFlag FINAL - enclosingNamerWithScope(clazz.owner.info.decls).ensureCompanionObject(cdef) + // Don't force the owner's info lest we create cycles as in SI-6357. + enclosingNamerWithScope(clazz.owner.rawInfo.decls).ensureCompanionObject(cdef) } result diff --git a/test/files/neg/t6357.check b/test/files/neg/t6357.check new file mode 100644 index 0000000000..a534d1439a --- /dev/null +++ b/test/files/neg/t6357.check @@ -0,0 +1,4 @@ +t6357.scala:3: error: value class may not be a local class + final class Y(val j: Int) extends AnyVal + ^ +one error found diff --git a/test/files/neg/t6357.scala b/test/files/neg/t6357.scala new file mode 100644 index 0000000000..47f5629638 --- /dev/null +++ b/test/files/neg/t6357.scala @@ -0,0 +1,6 @@ +object K { + def q = { + final class Y(val j: Int) extends AnyVal + 3 + } +} |