diff options
author | Martin Odersky <odersky@gmail.com> | 2008-12-11 14:34:37 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-12-11 14:34:37 +0000 |
commit | 61b353255e80babd2b00d5299cb6c5c5cade109f (patch) | |
tree | 938a5dbd1a83fb577e1f93241634a2464c4eb11f /src/compiler | |
parent | 1566ee0c368dadec297858d6ff3c849f70b5f137 (diff) | |
download | scala-61b353255e80babd2b00d5299cb6c5c5cade109f.tar.gz scala-61b353255e80babd2b00d5299cb6c5c5cade109f.tar.bz2 scala-61b353255e80babd2b00d5299cb6c5c5cade109f.zip |
switch to new initialization semantics.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Constructors.scala | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 7a6452709e..911dbba8c4 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -102,6 +102,7 @@ class Settings(error: String => Unit) { val assemname = StringSetting ("-Xassem", "file", "Name of the output assembly (only relevant with -target:msil)", "").dependsOn(target, "msil").hideToIDE val assemrefs = StringSetting ("-Xassem-path", "path", "List of assemblies referenced by the program (only relevant with -target:msil)", ".").dependsOn(target, "msil").hideToIDE val Xchecknull = BooleanSetting ("-Xcheck-null", "Emit warning on selection of nullable reference") + val Xwarninit = BooleanSetting ("-Xwarninit", "Warn about possible changes in initialization semantics") val checkInit = BooleanSetting ("-Xcheckinit", "Add runtime checks on field accessors. Uninitialized accesses result in an exception being thrown.") val noassertions = BooleanSetting ("-Xdisable-assertions", "Generate no assertions and assumptions") val Xexperimental = BooleanSetting ("-Xexperimental", "Enable experimental extensions") diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 9bccf5c95f..c69a288a8c 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -108,13 +108,13 @@ abstract class Constructors extends Transform { def canBeMoved(tree: Tree) = tree match { //todo: eliminate thisRefSeen case ValDef(mods, _, _, _) => - if (settings.Xexperimental.value) + if (settings.Xwarninit.value) if (!(mods hasFlag PRESUPER | PARAMACCESSOR) && !thisRefSeen && { val g = tree.symbol.getter(tree.symbol.owner); g != NoSymbol && !g.allOverriddenSymbols.isEmpty }) unit.warning(tree.pos, "the semantics of this definition has changed;\nthe initialization is no longer be executed before the superclass is called") - (mods hasFlag PRESUPER | PARAMACCESSOR) || !thisRefSeen && (!settings.future.value && !settings.checkInit.value) + (mods hasFlag PRESUPER | PARAMACCESSOR)// || !thisRefSeen && (!settings.future.value && !settings.checkInit.value) case _ => false } |