diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-20 22:03:39 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-20 22:03:39 +0200 |
commit | 850899b1c9347e804763a258f64d54cef0ffd69a (patch) | |
tree | 959b34dcb496e95bab7734fd92158ae456410ba6 | |
parent | 219e78bd7f052641cf8d6d91ee2b809e7746354b (diff) | |
parent | 347f01d46408d2430be3aea0184f5a6b8d9bbe81 (diff) | |
download | scala-850899b1c9347e804763a258f64d54cef0ffd69a.tar.gz scala-850899b1c9347e804763a258f64d54cef0ffd69a.tar.bz2 scala-850899b1c9347e804763a258f64d54cef0ffd69a.zip |
Merge pull request #4049 from lrytz/t8900
SI-8900 Don't assert !isDelambdafyFunction, it may not be accurate
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t8900.scala | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala index fc01f89580..54d4a30553 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala @@ -30,10 +30,10 @@ final class BCodeAsmCommon[G <: Global](val global: G) { */ def isAnonymousOrLocalClass(classSym: Symbol): Boolean = { assert(classSym.isClass, s"not a class: $classSym") - val res = (classSym.isAnonymousClass || !classSym.originalOwner.isClass) - // lambda classes are always top-level classes. - if (res) assert(!classSym.isDelambdafyFunction) - res + // Here used to be an `assert(!classSym.isDelambdafyFunction)`: delambdafy lambda classes are + // always top-level. However, SI-8900 shows an example where the weak name-based implementation + // of isDelambdafyFunction failed (for a function declared in a package named "lambda"). + classSym.isAnonymousClass || !classSym.originalOwner.isClass } /** diff --git a/test/files/pos/t8900.scala b/test/files/pos/t8900.scala new file mode 100644 index 0000000000..376bd786f2 --- /dev/null +++ b/test/files/pos/t8900.scala @@ -0,0 +1,11 @@ +package foo +package lambdaking + +class Test { + def byname(b: => Any) = ??? + def foo: Any = { + def bar: Any = { + byname(bar) + } + } +} |