summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-11-11 01:35:21 +0000
committerPaul Phillips <paulp@improving.org>2011-11-11 01:35:21 +0000
commit7f4fa0ec6f303c4ec535865a6cc5f117df221980 (patch)
tree864050d01c7629801a3e71d9128c70b20a6eb40f
parentd01ab1ba466c1c4778505ff4aa1747dde7309052 (diff)
downloadscala-7f4fa0ec6f303c4ec535865a6cc5f117df221980.tar.gz
scala-7f4fa0ec6f303c4ec535865a6cc5f117df221980.tar.bz2
scala-7f4fa0ec6f303c4ec535865a6cc5f117df221980.zip
A comment answering one of adriaan's philosophi...
A comment answering one of adriaan's philosophical musings on why programs fail, and a test case informed by the comment. Review by moors.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
-rw-r--r--test/files/pos/isApplicableSafe.scala8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 251d6e6f5c..e758c8960a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2246,6 +2246,12 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
// now fixed by using isWeaklyCompatible in exprTypeArgs
// TODO: understand why exactly -- some types were not inferred anymore (`ant clean quick.bin` failed)
// (I had expected inferMethodAlternative to pick up the slack introduced by using WildcardType here)
+ //
+ // @PP responds: I changed it to pass WildcardType instead of pt and only one line in
+ // trunk (excluding scalacheck, which had another) failed to compile. It was this line in
+ // Types: "refs = Array(Map(), Map())". I determined that inference fails if there are at
+ // least two invariant type parameters. See the test case I checked in to help backstop:
+ // pos/isApplicableSafe.scala.
isApplicableSafe(context.undetparams, followApply(pre.memberType(alt)), argtypes, pt)
}
if (sym.isOverloaded) {
diff --git a/test/files/pos/isApplicableSafe.scala b/test/files/pos/isApplicableSafe.scala
new file mode 100644
index 0000000000..591beb2b36
--- /dev/null
+++ b/test/files/pos/isApplicableSafe.scala
@@ -0,0 +1,8 @@
+class A {
+ // Any of Array[List[Symbol]], List[Array[Symbol]], or List[List[Symbol]] compile.
+ var xs: Array[Array[Symbol]] = _
+ var ys: Array[Map[Symbol, Set[Symbol]]] = _
+
+ xs = Array(Array())
+ ys = Array(Map(), Map())
+} \ No newline at end of file