From 01f6ed8e22d02811fe62b9183d9f84bdda5ede4b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 3 May 2012 23:11:05 -0700 Subject: Fix for one of the oldest open soundness bugs. Closes SI-963, since it was one of my random 30 it won the prize. The trick after adding the stability check (which has been sitting there commented out for 3+ years) was that implicit search depended on the wrongness, because memberWildcardType would create scopes with members of the form ?{ val name: tp } And since a def shouldn't match that, fixing it broke everything until I flipped it around: memberWildcardType should be seeking ?{ def name: tp } It could also search for a mutable value: the relevant quality is that it not be stable so it doesn't have a tighter type than the members it hopes to match. --- test/files/neg/t963.check | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/files/neg/t963.check (limited to 'test/files/neg/t963.check') diff --git a/test/files/neg/t963.check b/test/files/neg/t963.check new file mode 100644 index 0000000000..1f2d0687b3 --- /dev/null +++ b/test/files/neg/t963.check @@ -0,0 +1,12 @@ +t963.scala:14: error: stable identifier required, but Test.this.y3.x found. + val w3 : y3.x.type = y3.x + ^ +t963.scala:17: error: stable identifier required, but Test.this.y4.x found. + val w4 : y4.x.type = y4.x + ^ +t963.scala:10: error: type mismatch; + found : Object{def x: Integer} + required: AnyRef{val x: Integer} + val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) } + ^ +three errors found -- cgit v1.2.3