summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 11:40:10 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 11:40:10 -0700
commite0b3e9e755d42da7d26977a6c6908a4239e49f3a (patch)
tree1bb06c42f0031068ec699a1bb32b7984bc4b8c6e
parent00fd27c3b4355054c883a15e08b6cc2449ae9253 (diff)
parente6912050bf6132cbe6338ce1d6786703757575ce (diff)
downloadscala-e0b3e9e755d42da7d26977a6c6908a4239e49f3a.tar.gz
scala-e0b3e9e755d42da7d26977a6c6908a4239e49f3a.tar.bz2
scala-e0b3e9e755d42da7d26977a6c6908a4239e49f3a.zip
Merge pull request #981 from adriaanm/ticket-2038
SI-2038 make pt fully-defined when typing Typed
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
-rw-r--r--test/files/pos/t2038.scala5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index b1c3249e35..5c25cd008b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5019,7 +5019,9 @@ trait Typers extends Modes with Adaptations with Tags {
if (isPatternMode) {
val uncheckedTypeExtractor = extractorForUncheckedType(tpt.pos, tptTyped.tpe)
val ownType = inferTypedPattern(tptTyped, tptTyped.tpe, pt, canRemedy = uncheckedTypeExtractor.nonEmpty)
- treeTyped setType ownType
+ // println(s"Typed($expr, ${tpt.tpe}) : $pt --> $ownType (${isFullyDefined(ownType)}, ${makeFullyDefined(ownType)})")
+ // make fully defined to avoid bounded wildcard types that may be in pt from calling dropExistential (SI-2038)
+ treeTyped setType (if (isFullyDefined(ownType)) ownType else makeFullyDefined(ownType)) //ownType
uncheckedTypeExtractor match {
case None => treeTyped
diff --git a/test/files/pos/t2038.scala b/test/files/pos/t2038.scala
new file mode 100644
index 0000000000..17b1a702dd
--- /dev/null
+++ b/test/files/pos/t2038.scala
@@ -0,0 +1,5 @@
+class Test {
+ List(Some(classOf[java.lang.Integer]), Some(classOf[Int])).map {
+ case Some(f: Class[_]) => f.cast(???)
+ }
+} \ No newline at end of file