diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2016-08-29 11:55:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-29 11:55:33 +0200 |
commit | 66430e076dbe79553c930878aa47f183767c68af (patch) | |
tree | 747e29678c67330b02bc422bd330c978c3d16ced /test | |
parent | 3304bc33987f5821912bb0c7371b5e9a115c893d (diff) | |
parent | 8ef3e6e47098786f9522ebcaffaa261d8f240308 (diff) | |
download | scala-66430e076dbe79553c930878aa47f183767c68af.tar.gz scala-66430e076dbe79553c930878aa47f183767c68af.tar.bz2 scala-66430e076dbe79553c930878aa47f183767c68af.zip |
Merge pull request #5280 from retronym/ticket/8079
SI-8079 Only expand local aliases during variance checks
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t8079a.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8079a.scala | 4 | ||||
-rw-r--r-- | test/files/neg/variances.check | 2 | ||||
-rw-r--r-- | test/files/pos/t8079b.scala | 7 | ||||
-rw-r--r-- | test/pending/neg/t8079d.check | 4 | ||||
-rw-r--r-- | test/pending/neg/t8079d.scala | 4 | ||||
-rw-r--r-- | test/pending/pos/t8079c.scala | 7 |
7 files changed, 31 insertions, 1 deletions
diff --git a/test/files/neg/t8079a.check b/test/files/neg/t8079a.check new file mode 100644 index 0000000000..6bbe78afa6 --- /dev/null +++ b/test/files/neg/t8079a.check @@ -0,0 +1,4 @@ +t8079a.scala:3: error: contravariant type I occurs in covariant position in type C.this.X of value b + def f2(b: X): Unit + ^ +one error found diff --git a/test/files/neg/t8079a.scala b/test/files/neg/t8079a.scala new file mode 100644 index 0000000000..4997ea282e --- /dev/null +++ b/test/files/neg/t8079a.scala @@ -0,0 +1,4 @@ +trait C[-I] { + private[this] type X = C[I] + def f2(b: X): Unit +} diff --git a/test/files/neg/variances.check b/test/files/neg/variances.check index cb1a60a632..3c1545a375 100644 --- a/test/files/neg/variances.check +++ b/test/files/neg/variances.check @@ -19,7 +19,7 @@ variances.scala:74: error: covariant type A occurs in contravariant position in variances.scala:89: error: covariant type T occurs in invariant position in type T of type A type A = T ^ -variances.scala:90: error: covariant type T occurs in contravariant position in type => test.TestAlias.B[C.this.A] of method foo +variances.scala:90: error: covariant type A occurs in contravariant position in type => test.TestAlias.B[C.this.A] of method foo def foo: B[A] ^ 8 errors found diff --git a/test/files/pos/t8079b.scala b/test/files/pos/t8079b.scala new file mode 100644 index 0000000000..f3b7b78077 --- /dev/null +++ b/test/files/pos/t8079b.scala @@ -0,0 +1,7 @@ +trait F1[/* - */T, /* + */ R] + +object Test { + import scala.annotation.unchecked._ + type VariantF1[-T, +R] = F1[T @uncheckedVariance, R @uncheckedVariance] + trait C[+T] { def foo: VariantF1[Any, T] } +} diff --git a/test/pending/neg/t8079d.check b/test/pending/neg/t8079d.check new file mode 100644 index 0000000000..f63f4902f8 --- /dev/null +++ b/test/pending/neg/t8079d.check @@ -0,0 +1,4 @@ +t8079d.scala:3: error: contravariant type I occurs in covariant position in type C.this.X of value b + def f2(b: X): Unit + ^ +one error found diff --git a/test/pending/neg/t8079d.scala b/test/pending/neg/t8079d.scala new file mode 100644 index 0000000000..ad420b99e3 --- /dev/null +++ b/test/pending/neg/t8079d.scala @@ -0,0 +1,4 @@ +trait C[-I] { + protected[this] type X = C[I] + def f2(b: X): Unit +} diff --git a/test/pending/pos/t8079c.scala b/test/pending/pos/t8079c.scala new file mode 100644 index 0000000000..ae7f37e2bf --- /dev/null +++ b/test/pending/pos/t8079c.scala @@ -0,0 +1,7 @@ +trait F1[/* - */T, /* + */ R] + +object Test { + import scala.annotation.unchecked._ + private[this] type VariantF1[-T, +R] = F1[T @uncheckedVariance, R @uncheckedVariance] + trait C[+T] { def foo: VariantF1[Any, T] } +} |