diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-04 22:56:07 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-04 22:57:46 -0700 |
commit | 5d6ba0c99ba010594bd434948b54e6c5dd1f7cf1 (patch) | |
tree | 7b7e9816a5edd7bcd1c9da6ed7abc78272e4a791 /src/compiler/scala/tools/nsc/transform/CleanUp.scala | |
parent | c24be0eaa2d1c65d9cf8922f0917e77bd1d03707 (diff) | |
parent | adf2d3632b07eef4fc2303aef994e66584a73f49 (diff) | |
download | scala-5d6ba0c99ba010594bd434948b54e6c5dd1f7cf1.tar.gz scala-5d6ba0c99ba010594bd434948b54e6c5dd1f7cf1.tar.bz2 scala-5d6ba0c99ba010594bd434948b54e6c5dd1f7cf1.zip |
Merge remote-tracking branch 'origin/2.10.x' into merge-210
# By Eugene Burmako (10) and others
# Via Josh Suereth (10) and Paul Phillips (9)
* origin/2.10.x: (32 commits)
Removing duplication from Duration.
Fixed positions in de-aliased special symbols and for automatically added `apply` methods.
Fixes SI-6285 - ParIterableLike no longer says sequential foreach.
SI-6274 Fix owners when eta-expanding function with byName param
Fixes typos in the ScalaDoc of StringContext
Allow nested calls to `askForResponse` in the presentation compiler.
Made Dynamic extend Any.
Fix for SI-6273, repl string interpolation.
Formatting cleanup in def typed.
Better errors for Any/AnyRef issues.
Fix for SI-6263, futile adaptation.
Suppressed 'possible cause' mis-warning.
Fix for SI-6034, covariant value classes.
Fixes SI-6290 by creating real instnaces of language features.
SBT build now works with SBT 0.12.
Removed previosuly uncommented code, added more diagnosis output to REPL.
Made instrumenter more robust by looking at tokens
Removed dead code.
Two fixes for the worksheet instrumenter
Fix SI-6294.
...
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/CleanUp.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 1aa170a07e..3630cb3dbe 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -562,6 +562,10 @@ abstract class CleanUp extends Transform with ast.TreeDSL { else tree } + case DefDef(mods, name, tps, vps, tp, rhs) if tree.symbol.hasStaticAnnotation => + reporter.error(tree.pos, "The @static annotation is not allowed on method definitions.") + super.transform(tree) + case ValDef(mods, name, tpt, rhs) if tree.symbol.hasStaticAnnotation => def transformStaticValDef = { log("moving @static valdef field: " + name + ", in: " + tree.symbol.owner) @@ -604,7 +608,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL { } // create a static field in the companion class for this @static field - val stfieldSym = linkedClass.newVariable(newTermName(name), tree.pos, STATIC | SYNTHETIC | FINAL) setInfo sym.tpe + val stfieldSym = linkedClass.newValue(newTermName(name), tree.pos, STATIC | SYNTHETIC | FINAL) setInfo sym.tpe + if (sym.isMutable) stfieldSym.setFlag(MUTABLE) stfieldSym.addAnnotation(StaticClass) val names = classNames.getOrElseUpdate(linkedClass, linkedClass.info.decls.collect { @@ -780,7 +785,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL { staticSym <- clazz.info.decls if staticSym.hasStaticAnnotation } staticSym match { - case stfieldSym if stfieldSym.isVariable => + case stfieldSym if (stfieldSym.isValue && !stfieldSym.isMethod) || stfieldSym.isVariable => + log(stfieldSym + " is value: " + stfieldSym.isValue) val valdef = staticBodies((clazz, stfieldSym)) val ValDef(_, _, _, rhs) = valdef val fixedrhs = rhs.changeOwner((valdef.symbol, clazz.info.decl(nme.CONSTRUCTOR))) |