From 448e3d86a4c5c95adbb0d2743f321005b12954ee Mon Sep 17 00:00:00 2001 From: dragos Date: Mon, 16 Jul 2007 21:40:18 +0000 Subject: [PATCH] Added assertion to prevent using packages as values git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@12327 5e8d7ff9-d8ef-0310-90f0-a4852d11357a --- src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 0dbab1da2..7451d41aa 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -845,6 +845,7 @@ abstract class GenICode extends SubComponent { if (tree.symbol.isModuleClass && tree.symbol != ctx.clazz.symbol) { if (settings.debug.value) log("LOAD_MODULE from 'This': " + tree.symbol); + assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) ctx.bb.emit(LOAD_MODULE(tree.symbol), tree.pos) generatedType = REFERENCE(tree.symbol) } else { @@ -863,6 +864,7 @@ abstract class GenICode extends SubComponent { " at: " + (tree.pos)) if (settings.debug.value) log("LOAD_MODULE from Select(): " + tree.symbol); + assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) ctx.bb.emit(LOAD_MODULE(tree.symbol), tree.pos) ctx @@ -873,6 +875,7 @@ abstract class GenICode extends SubComponent { if (sym.isModule) { if (settings.debug.value) log("LOAD_MODULE from Select(qualifier, selector): " + sym); + assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) ctx.bb.emit(LOAD_MODULE(sym), tree.pos); ctx } else if (isStaticSymbol(sym)) { @@ -889,6 +892,7 @@ abstract class GenICode extends SubComponent { if (tree.symbol.isModule) { if (settings.debug.value) log("LOAD_MODULE from Ident(name): " + tree.symbol); + assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) ctx.bb.emit(LOAD_MODULE(tree.symbol), tree.pos) generatedType = toTypeKind(tree.symbol.info) } else {