diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-24 14:11:20 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-24 14:11:20 +0000 |
commit | 70996f8583ba28de3dfe97bb3e7075cb56a4ea2f (patch) | |
tree | 45f5c6ce758fe4564b3f21f8df3877302f2cdd34 | |
parent | 78db538e1dd1b9f4d078309568d237fa6c1fb25c (diff) | |
download | scala-70996f8583ba28de3dfe97bb3e7075cb56a4ea2f.tar.gz scala-70996f8583ba28de3dfe97bb3e7075cb56a4ea2f.tar.bz2 scala-70996f8583ba28de3dfe97bb3e7075cb56a4ea2f.zip |
Added a -Yno-productN option.
Suppresses ProductN parent for case classes. No review.
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 1 | ||||
-rw-r--r-- | test/files/pos/noproductN.flags | 1 | ||||
-rw-r--r-- | test/files/pos/noproductN.scala | 2 |
4 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 394192e22f..b0991a9c83 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2687,7 +2687,7 @@ self => if (mods.isCase) { val arity = if (vparamss.isEmpty || vparamss.head.isEmpty) 0 else vparamss.head.size productConstr :: serializableConstr :: { - if (arity == 0) Nil + if (arity == 0 || settings.YnoProductN.value) Nil else List( AppliedTypeTree( productConstrN(arity), diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 6c7c8757bd..b15f338938 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -175,6 +175,7 @@ trait ScalaSettings extends AbsScalaSettings val YvirtClasses = false // too embryonic to even expose as a -Y //BooleanSetting ("-Yvirtual-classes", "Support virtual classes") val exposeEmptyPackage = BooleanSetting("-Yexpose-empty-package", "Internal only: expose the empty package.").internalOnly() + val YnoProductN = BooleanSetting ("-Yno-productN", "Do not add ProductN to case classes") def stop = stopAfter diff --git a/test/files/pos/noproductN.flags b/test/files/pos/noproductN.flags new file mode 100644 index 0000000000..14b05e7354 --- /dev/null +++ b/test/files/pos/noproductN.flags @@ -0,0 +1 @@ +-Yno-productN
\ No newline at end of file diff --git a/test/files/pos/noproductN.scala b/test/files/pos/noproductN.scala new file mode 100644 index 0000000000..856d960b7d --- /dev/null +++ b/test/files/pos/noproductN.scala @@ -0,0 +1,2 @@ +object Foo { type S = String } +case class Foo(x: Foo.S) { } |