diff options
author | Simon Ochsenreither <simon@ochsenreither.de> | 2011-12-07 17:20:29 +0100 |
---|---|---|
committer | Simon Ochsenreither <simon@ochsenreither.de> | 2011-12-07 21:40:49 +0100 |
commit | 60b90b18d6407b886ed9f12061406fd3ece05e29 (patch) | |
tree | 9dc557c387063597c6bf3058666e28495770480e /src/compiler | |
parent | 332fec96e31840878bed41dd7b5314b97d8da7c2 (diff) | |
download | scala-60b90b18d6407b886ed9f12061406fd3ece05e29.tar.gz scala-60b90b18d6407b886ed9f12061406fd3ece05e29.tar.bz2 scala-60b90b18d6407b886ed9f12061406fd3ece05e29.zip |
Migration message and version cleanup
The @migration annotation can now be used like @deprecation.
Old syntax is still supported, but deprecated.
Improve wording and consistency of migration messages, migration
warnings also print the version in which the change occurred now.
Partially fixes SI-4990.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index a59ea2c1bf..75fd733e7e 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -494,8 +494,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => // string. So this needs attention. For now the fact that migration is // private[scala] ought to provide enough protection. def hasMigrationAnnotation = hasAnnotation(MigrationAnnotationClass) - def migrationMessage = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(2) } - def migrationVersion = getAnnotation(MigrationAnnotationClass) map { version => version.intArg(0).get + "." + version.intArg(1).get } + def migrationMessage = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(0) } + def migrationVersion = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(1) } def elisionLevel = getAnnotation(ElidableMethodClass) flatMap { _.intArg(0) } def implicitNotFoundMsg = getAnnotation(ImplicitNotFoundClass) flatMap { _.stringArg(0) } diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 645d3ecfa0..98f1c96cad 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1273,8 +1273,10 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R * indicating it has changed semantics between versions. */ private def checkMigration(sym: Symbol, pos: Position) = { - for (msg <- sym.migrationMessage) - unit.warning(pos, sym.fullLocationString + " has changed semantics:\n" + msg) + if (sym.hasMigrationAnnotation) + unit.warning(pos, "%s has changed semantics in version %s:\n%s".format( + sym.fullLocationString, sym.migrationVersion.get, sym.migrationMessage.get) + ) } private def lessAccessible(otherSym: Symbol, memberSym: Symbol): Boolean = ( |