diff options
-rw-r--r-- | src/compiler/scala/reflect/internal/Types.scala | 10 | ||||
-rw-r--r-- | test/files/pos/raw-map/J_1.java | 4 | ||||
-rw-r--r-- | test/files/pos/raw-map/S_2.scala | 6 |
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) + } +} |