summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-05-22 15:24:38 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-05-22 15:24:38 -0700
commitee898dc56eb2722999f067d99349a98ac40ff601 (patch)
treea97d9b16efe33ce42bd41117686b6c24daeb6dfa
parentb801c8432dd5520f1564d3acd902baa47c6e2bd8 (diff)
parentf5df207f95087c38b2936429cf793d63f0b68c24 (diff)
downloadscala-ee898dc56eb2722999f067d99349a98ac40ff601.tar.gz
scala-ee898dc56eb2722999f067d99349a98ac40ff601.tar.bz2
scala-ee898dc56eb2722999f067d99349a98ac40ff601.zip
Merge pull request #588 from retronym/ticket/5305
Don't hop to the first enclosing, non-silent context typing refinements
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
-rw-r--r--test/files/neg/t3614.check4
-rw-r--r--test/files/neg/t3614.scala3
-rw-r--r--test/files/pos/t3856.scala1
-rw-r--r--test/files/pos/t5305.scala13
5 files changed, 22 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index e40a567f1d..b1698ccb36 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2510,10 +2510,7 @@ trait Typers extends Modes with Adaptations with Taggings {
namer.enterSyms(stats)
// need to delay rest of typedRefinement to avoid cyclic reference errors
unit.toCheck += { () =>
- // go to next outer context which is not silent, see #3614
- var c = context
- while (c.bufferErrors) c = c.outer
- val stats1 = newTyper(c).typedStats(stats, NoSymbol)
+ val stats1 = typedStats(stats, NoSymbol)
for (stat <- stats1 if stat.isDef) {
val member = stat.symbol
if (!(context.owner.ancestors forall
diff --git a/test/files/neg/t3614.check b/test/files/neg/t3614.check
new file mode 100644
index 0000000000..5fdb5cbf1f
--- /dev/null
+++ b/test/files/neg/t3614.check
@@ -0,0 +1,4 @@
+t3614.scala:2: error: class type required but AnyRef{def a: <?>} found
+ def v = new ({ def a=0 })
+ ^
+one error found \ No newline at end of file
diff --git a/test/files/neg/t3614.scala b/test/files/neg/t3614.scala
new file mode 100644
index 0000000000..5b02cdf2b2
--- /dev/null
+++ b/test/files/neg/t3614.scala
@@ -0,0 +1,3 @@
+object t3614 {
+ def v = new ({ def a=0 })
+} \ No newline at end of file
diff --git a/test/files/pos/t3856.scala b/test/files/pos/t3856.scala
index fd253a56a8..5ea4b84e2c 100644
--- a/test/files/pos/t3856.scala
+++ b/test/files/pos/t3856.scala
@@ -2,6 +2,7 @@ case class C[T](x: T)
case class CS(xs: C[_]*)
+// t3856
object Test {
val x = CS(C(5), C("abc")) match { case CS(C(5), xs @ _*) => xs }
println(x)
diff --git a/test/files/pos/t5305.scala b/test/files/pos/t5305.scala
new file mode 100644
index 0000000000..4c32cd7c6d
--- /dev/null
+++ b/test/files/pos/t5305.scala
@@ -0,0 +1,13 @@
+object t5305 {
+ def in(a: Any) = {}
+
+ object O {
+ type F = Int
+ val v = ""
+ }
+
+ in {
+ import O.{F, v}
+ type x = {type l = (F, v.type)} // not found: type F
+ }
+}