summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-14 23:48:24 -0800
committerPaul Phillips <paulp@improving.org>2012-01-14 23:50:03 -0800
commitc5b15c4d2997cf97b1998b2ae1d524b0b836e5fd (patch)
tree252757a534691aff796d4ed553aa8aeeb13554f0
parent9eb56b99610d734088a0dd2da7cded49211eff3a (diff)
downloadscala-c5b15c4d2997cf97b1998b2ae1d524b0b836e5fd.tar.gz
scala-c5b15c4d2997cf97b1998b2ae1d524b0b836e5fd.tar.bz2
scala-c5b15c4d2997cf97b1998b2ae1d524b0b836e5fd.zip
Fix for raw types issue found in the IDE.
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala10
-rw-r--r--test/files/pos/raw-map/J_1.java4
-rw-r--r--test/files/pos/raw-map/S_2.scala6
3 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 3d3dd81f1b..dfe098e282 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -3365,7 +3365,9 @@ trait Types extends api.Types { self: SymbolTable =>
/** Guard these lists against AnyClass and NothingClass appearing,
* else loBounds.isEmpty will have different results for an empty
- * constraint and one with Nothing as a lower bound.
+ * constraint and one with Nothing as a lower bound. [Actually
+ * guarding addLoBound/addHiBound somehow broke raw types so it
+ * only guards against being created with them.]
*/
private var lobounds = lo0 filterNot (_.typeSymbolDirect eq NothingClass)
private var hibounds = hi0 filterNot (_.typeSymbolDirect eq AnyClass)
@@ -3384,8 +3386,7 @@ trait Types extends api.Types { self: SymbolTable =>
else if (!isNumericSubType(tp, numlo))
numlo = numericLoBound
}
- else if (tp.typeSymbolDirect ne NothingClass)
- lobounds ::= tp
+ else lobounds ::= tp
}
def checkWidening(tp: Type) {
@@ -3404,8 +3405,7 @@ trait Types extends api.Types { self: SymbolTable =>
else if (!isNumericSubType(numhi, tp))
numhi = numericHiBound
}
- else if (tp.typeSymbolDirect ne AnyClass)
- hibounds ::= tp
+ else hibounds ::= tp
}
def isWithinBounds(tp: Type): Boolean =
diff --git a/test/files/pos/raw-map/J_1.java b/test/files/pos/raw-map/J_1.java
new file mode 100644
index 0000000000..bd43bcac81
--- /dev/null
+++ b/test/files/pos/raw-map/J_1.java
@@ -0,0 +1,4 @@
+public class J_1 {
+ public void setRawType(java.util.Map x) {
+ }
+}
diff --git a/test/files/pos/raw-map/S_2.scala b/test/files/pos/raw-map/S_2.scala
new file mode 100644
index 0000000000..de6c4ee5c2
--- /dev/null
+++ b/test/files/pos/raw-map/S_2.scala
@@ -0,0 +1,6 @@
+class Foo {
+ def foo {
+ val x: J_1 = null
+ x.setRawType(new java.util.HashMap)
+ }
+}