From 518635385ac1ba14aa230de3e431793331300546 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Fri, 22 Nov 2013 16:28:51 +0100 Subject: SI-7872 Plug a variance exploit in refinement types Refinement types are collapsed to a TypeTree with an original during type checking; this was enough to evade variance validation in refchecks. This commit: - validates the original of `TypeTree`s in refchecks - changes VarianceValidator to recurse into: - the originals of `TypeTree`s - `TypTree` (to cover, e.g. `CompoundTypeTree` / `SelectFromTypeTree`) It also finds an unreported variance violation in an existing test case, variances.scala. This looks to be legitimate. --- test/files/neg/t7872c.check | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/files/neg/t7872c.check (limited to 'test/files/neg/t7872c.check') diff --git a/test/files/neg/t7872c.check b/test/files/neg/t7872c.check new file mode 100644 index 0000000000..469449dbd5 --- /dev/null +++ b/test/files/neg/t7872c.check @@ -0,0 +1,11 @@ +t7872c.scala:7: error: inferred kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type F). +List's type parameters do not match type F's expected parameters: +type A is covariant, but type _ is declared contravariant + down(List('whatever: Object)) + ^ +t7872c.scala:7: error: type mismatch; + found : List[Object] + required: F[Object] + down(List('whatever: Object)) + ^ +two errors found -- cgit v1.2.3