aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-03-16 19:36:38 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-03-16 20:02:39 +0100
commit675892a4aaa77a4e71faa6057b4a0a059acb408d (patch)
treec1dc2fdac6dc67c8f4b933d7e91369349114105b /tests/pos
parent96c6d38649d0f1605a31f542a53509d57af79709 (diff)
downloaddotty-675892a4aaa77a4e71faa6057b4a0a059acb408d.tar.gz
dotty-675892a4aaa77a4e71faa6057b4a0a059acb408d.tar.bz2
dotty-675892a4aaa77a4e71faa6057b4a0a059acb408d.zip
Reduce type lambdas even if variance changes
Previously, the added testcase failed with (when running with -Ydebug-alias): 2 | def foo = Seq(a) | ^ |covariant type A occurs in invariant position in type => Seq.CC[Cov.this.A] of method foo Because the type parameter of `CC` is invariant. Of course, this is fine because `CC[A]` can be reduced to `Seq[A]`, but before this commit, `TypeApplications#appliedTo` used to disallow reductions that replaced an invariant type parameter with a variant one. I believe that for type inference, only preserving the arity is important, so I removed this restriction.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/hk-reduce-variance.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/pos/hk-reduce-variance.scala b/tests/pos/hk-reduce-variance.scala
new file mode 100644
index 000000000..c69777992
--- /dev/null
+++ b/tests/pos/hk-reduce-variance.scala
@@ -0,0 +1,3 @@
+class Cov[+A](a: A) {
+ def foo = Seq(a)
+}