summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-03-10 10:11:28 -0700
committerPaul Phillips <paulp@improving.org>2013-03-10 21:20:50 -0700
commit9c5ea96b1c0fa45037a96e530b6ae71687a292d1 (patch)
tree15dbf04911a2f2b6ec955eb51b0c1c19f6adaea6 /src/compiler
parentcb02c96bed1454e1c0702c529366f3c40d6bffd9 (diff)
downloadscala-9c5ea96b1c0fa45037a96e530b6ae71687a292d1.tar.gz
scala-9c5ea96b1c0fa45037a96e530b6ae71687a292d1.tar.bz2
scala-9c5ea96b1c0fa45037a96e530b6ae71687a292d1.zip
Moved some numeric subtyping logic closer to center.
Fixed bug in numeric widening related to continuations, which enabled simplifying isNumericSubType.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index a110d6d15d..c19d6b7a56 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1124,16 +1124,19 @@ trait Typers extends Adaptations with Tags {
else {
if (mode.inExprModeButNot(FUNmode)) {
pt.dealias match {
- case TypeRef(_, sym, _) =>
+ // The <: Any requirement inhibits attempts to adapt continuation types
+ // to non-continuation types.
+ case TypeRef(_, sym, _) if tree.tpe <:< AnyClass.tpe =>
// note: was if (pt.typeSymbol == UnitClass) but this leads to a potentially
// infinite expansion if pt is constant type ()
- if (sym == UnitClass && tree.tpe <:< AnyClass.tpe) { // (12)
+ if (sym == UnitClass) { // (12)
if (settings.warnValueDiscard.value)
context.unit.warning(tree.pos, "discarded non-Unit value")
return typedPos(tree.pos, mode, pt) {
Block(List(tree), Literal(Constant()))
}
- } else if (isNumericValueClass(sym) && isNumericSubType(tree.tpe.dealiasWiden, pt)) {
+ }
+ else if (isNumericValueClass(sym) && isNumericSubType(tree.tpe, pt)) {
if (settings.warnNumericWiden.value)
context.unit.warning(tree.pos, "implicit numeric widening")
return typedPos(tree.pos, mode, pt) {