summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/UnCurry.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-27 19:51:27 +0000
committerPaul Phillips <paulp@improving.org>2010-09-27 19:51:27 +0000
commita56c33b6a470939a1396015972f09e19dc493245 (patch)
tree4c38946754440c8860180ccda2b1bb83eb938a3a /src/compiler/scala/tools/nsc/transform/UnCurry.scala
parentb40f4ba3221f1091f4821423f18c157907e9a3c7 (diff)
downloadscala-a56c33b6a470939a1396015972f09e19dc493245.tar.gz
scala-a56c33b6a470939a1396015972f09e19dc493245.tar.bz2
scala-a56c33b6a470939a1396015972f09e19dc493245.zip
Bringing the tree and icode checkers back to life.
build/pack/bin/scalac -d /tmp -Ycheck-debug -Ycheck:all \ src/compiler/scala/tools/nsc/Global.scala That blows up in constructors as most files do, so also try it with -Ycheck:icode to see the pretty icode output (for a little while anyway, after which it will again blow up.) Our work has only just begun! See test/checker-tests/fail*.scala for 11 examples of places where the checker cries foul. Many of them are telling us about real issues and we should listen, but I will need help to figure out which are legitimate and which should be eliminated by altering the checkers. This patch also hacks on some territory the checkers drew me into, especially TypeKinds, where I figured anything which had been commented out since 2005 was fair game. (Optional) review by dragos. (The one place I know I could use a look is in Checkers.scala, because I had to relax some checks and add at least one newer opcode.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/UnCurry.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index c4074d7efc..85db55472d 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -188,7 +188,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
* additional parameter sections of a case class are skipped.
*/
def uncurryTreeType(tp: Type): Type = tp match {
- case MethodType(params, MethodType(params1, restpe)) if (inPattern) =>
+ case MethodType(params, MethodType(params1, restpe)) if inPattern =>
uncurryTreeType(MethodType(params, restpe))
case _ =>
uncurry(tp)
@@ -204,14 +204,12 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
private val nonLocalReturnKeys = new HashMap[Symbol, Symbol]
/** Return non-local return key for given method */
- private def nonLocalReturnKey(meth: Symbol) = nonLocalReturnKeys.get(meth) match {
- case Some(k) => k
- case None =>
- val k = meth.newValue(meth.pos, unit.fresh.newName(meth.pos, "nonLocalReturnKey"))
- .setFlag(SYNTHETIC).setInfo(ObjectClass.tpe)
- nonLocalReturnKeys(meth) = k
- k
- }
+ private def nonLocalReturnKey(meth: Symbol) =
+ nonLocalReturnKeys.getOrElseUpdate(meth, {
+ meth.newValue(meth.pos, unit.fresh.newName(meth.pos, "nonLocalReturnKey"))
+ .setFlag (SYNTHETIC)
+ .setInfo (ObjectClass.tpe)
+ })
/** Generate a non-local return throw with given return expression from given method.
* I.e. for the method's non-local return key, generate: