From f7751134d1c090d16e8121cc5fade6b9a1a17550 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 9 Sep 2010 09:45:38 +0000 Subject: fix fix for (close #3791) and made deprecation ... fix fix for (close #3791) and made deprecation for constants work. no review. --- src/compiler/scala/tools/nsc/symtab/Definitions.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index a7fbcd7019..16563bb38c 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -738,7 +738,7 @@ trait Definitions extends reflect.generic.StandardDefinitions { addModuleMethod(FloatClass, "MinNegativeValue", -java.lang.Float.MAX_VALUE) addModuleMethod(FloatClass, "MaxValue", java.lang.Float.MAX_VALUE) addDeprecatedModuleMethod(FloatClass, "Epsilon", java.lang.Float.MIN_VALUE, "use Float.MinPositiveValue instead") - addModuleMethod(FloatClass, "MinPositiveValue", -java.lang.Float.MAX_VALUE) + addModuleMethod(FloatClass, "MinPositiveValue", java.lang.Float.MIN_VALUE) addModuleMethod(FloatClass, "NaN", java.lang.Float.NaN) addModuleMethod(FloatClass, "PositiveInfinity", java.lang.Float.POSITIVE_INFINITY) addModuleMethod(FloatClass, "NegativeInfinity", java.lang.Float.NEGATIVE_INFINITY) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index c86fc05c47..8248c5c950 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -780,6 +780,11 @@ trait Typers { self: Analyzer => case atp @ AnnotatedType(_, _, _) if canAdaptAnnotations(tree, mode, pt) => // (-1) adaptAnnotations(tree, mode, pt) case ct @ ConstantType(value) if ((mode & (TYPEmode | FUNmode)) == 0 && (ct <:< pt) && !onlyPresentation) => // (0) + val sym = tree.symbol + if (sym != null && sym.isDeprecated) { + val msg = sym.toString + sym.locationString +" is deprecated: "+ sym.deprecationMessage.getOrElse("") + unit.deprecationWarning(tree.pos, msg) + } treeCopy.Literal(tree, value) case OverloadedType(pre, alts) if ((mode & FUNmode) == 0) => // (1) inferExprAlternative(tree, pt) -- cgit v1.2.3