diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-27 01:05:02 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-27 01:05:02 +0000 |
commit | b6fb314419101bf4ca2959d949723de1af675ffb (patch) | |
tree | 7c2078b66438ceaa3017edbc07d1fd11154f7680 /src/compiler | |
parent | 07a2981402f85d6b60cf6fe7b927e8c842469bd2 (diff) | |
download | scala-b6fb314419101bf4ca2959d949723de1af675ffb.tar.gz scala-b6fb314419101bf4ca2959d949723de1af675ffb.tar.bz2 scala-b6fb314419101bf4ca2959d949723de1af675ffb.zip |
Since we generate no invalid generic signatures...
Since we generate no invalid generic signatures at the moment, I decided
to strike while the iron is hot and turned on warnings for when the
sig parser fails. It is likely we still generate bad signatures in
some cases, but they're no longer uncovered by compiling the compiler:
hopefully the community will help us out by reporting any found in the
wild. (The issued warning helpfully suggests exactly this.) No review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 18 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 1 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index fd210dd35e..2562d37450 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -12,6 +12,7 @@ import java.nio.ByteBuffer import scala.collection.{ mutable, immutable } import mutable.{ ListBuffer, LinkedHashSet } import scala.reflect.generic.{ PickleFormat, PickleBuffer } +import scala.tools.reflect.SigParser import scala.tools.nsc.io.AbstractFile import scala.tools.nsc.symtab._ import scala.tools.nsc.symtab.classfile.ClassfileConstants._ @@ -513,10 +514,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid { } /** Run the signature parser to catch bogus signatures. - * XXX But we should not be generating bogus signatures! - * The ticket is #4067. */ - import scala.tools.reflect.SigParser def isValidSignature(sym: Symbol, sig: String) = ( if (sym.isMethod) SigParser verifyMethod sig else if (sym.isTerm) SigParser verifyType sig @@ -558,14 +556,12 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid { buf putShort index addAttribute(jmember, tpnme.SignatureATTR, buf) } - else { - val msg = "!! Suppressing invalid generic sig for %s in %s: %s".format( - sym, sym.owner.skipPackageObject.fullName, sig - ) - - if (settings.Yverifysigs.value) Console.println(msg) - else log(msg) - } + else clasz.cunit.warning(sym.pos, + """|compiler bug: created invalid generic signature for %s in %s + |signature: %s + |if this is reproducible, please report bug at http://lampsvn.epfl.ch/trac/scala + """.trim.stripMargin.format(sym, sym.owner.skipPackageObject.fullName, sig) + ) } } } diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 57de25b694..8025254fc5 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -108,7 +108,6 @@ trait ScalaSettings extends AbsScalaSettings with StandardScalaSettings { val log = PhasesSetting ("-Ylog", "Log operations during") val Ylogcp = BooleanSetting ("-Ylog-classpath", "Output information about what classpath is being applied.") val Ynogenericsig = BooleanSetting ("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.") - val Yverifysigs = BooleanSetting ("-Yverify-generics", "Output a message when an invalid generic signature is suppressed.") val noimports = BooleanSetting ("-Yno-imports", "Compile without any implicit imports.") // Not actually doing anything, so disabled. // val nopredefs = BooleanSetting ("-Yno-predefs", "Compile without any implicit predefined values.") |