summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-09-13 06:07:23 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-09-13 06:07:23 -0700
commit33ba866fd22a4a5542ae5e4dae8de8bf8d8ab2aa (patch)
tree64351f36b81bb611cf7e6f8fb18fd9d7b75a5dfb /src
parent20f701bf504530cb12e9d24e2dd66fa42244664d (diff)
parent6fbb4ac42a3fa00689a6c3bbde2be273b7c36b2d (diff)
downloadscala-33ba866fd22a4a5542ae5e4dae8de8bf8d8ab2aa.tar.gz
scala-33ba866fd22a4a5542ae5e4dae8de8bf8d8ab2aa.tar.bz2
scala-33ba866fd22a4a5542ae5e4dae8de8bf8d8ab2aa.zip
Merge pull request #1294 from paulp/issue/6367
Fix for SI-6367, exponential time in inference.
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index df44cf234e..29f7b53154 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -3935,13 +3935,15 @@ trait Types extends api.Types { self: SymbolTable =>
def avoidWiden: Boolean = avoidWidening
def addLoBound(tp: Type, isNumericBound: Boolean = false) {
- if (isNumericBound && isNumericValueType(tp)) {
- if (numlo == NoType || isNumericSubType(numlo, tp))
- numlo = tp
- else if (!isNumericSubType(tp, numlo))
- numlo = numericLoBound
+ if (!lobounds.contains(tp)) {
+ if (isNumericBound && isNumericValueType(tp)) {
+ if (numlo == NoType || isNumericSubType(numlo, tp))
+ numlo = tp
+ else if (!isNumericSubType(tp, numlo))
+ numlo = numericLoBound
+ }
+ else lobounds ::= tp
}
- else lobounds ::= tp
}
def checkWidening(tp: Type) {
@@ -3953,14 +3955,16 @@ trait Types extends api.Types { self: SymbolTable =>
}
def addHiBound(tp: Type, isNumericBound: Boolean = false) {
- checkWidening(tp)
- if (isNumericBound && isNumericValueType(tp)) {
- if (numhi == NoType || isNumericSubType(tp, numhi))
- numhi = tp
- else if (!isNumericSubType(numhi, tp))
- numhi = numericHiBound
+ if (!hibounds.contains(tp)) {
+ checkWidening(tp)
+ if (isNumericBound && isNumericValueType(tp)) {
+ if (numhi == NoType || isNumericSubType(tp, numhi))
+ numhi = tp
+ else if (!isNumericSubType(numhi, tp))
+ numhi = numericHiBound
+ }
+ else hibounds ::= tp
}
- else hibounds ::= tp
}
def isWithinBounds(tp: Type): Boolean =