summaryrefslogtreecommitdiff
path: root/test/files/pos/t8403.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-03-13 09:35:37 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-03-13 09:43:25 +0100
commit0226345811636d05d67bbd574829df1515dff136 (patch)
treeb19ab53015e1c2d80f4fd536af71a1dcfffb2fa2 /test/files/pos/t8403.scala
parent9c38e86a5526887f93a3f031b19a0e4fa31745d3 (diff)
downloadscala-0226345811636d05d67bbd574829df1515dff136.tar.gz
scala-0226345811636d05d67bbd574829df1515dff136.tar.bz2
scala-0226345811636d05d67bbd574829df1515dff136.zip
SI-8403 Fix regression in name binding with imports in templates
Regressed in dbd8457 which changed `Context#make` to automatically include the imports from the given `Tree` if it was an `Import` tree, rather than requiring callers to call `makeNewImport`. However, this turns out to double up the imports for the "inner" namer of a template that starts with imports. The inner namer has a new scope, but the same owner and tree as its parent. This commit detects this case by seeing if the `Import` tree used to consruct the child context is the same as the parent context. If that is the case, we don't augment `Context#imports`.
Diffstat (limited to 'test/files/pos/t8403.scala')
-rw-r--r--test/files/pos/t8403.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/pos/t8403.scala b/test/files/pos/t8403.scala
new file mode 100644
index 0000000000..eea60ed7ff
--- /dev/null
+++ b/test/files/pos/t8403.scala
@@ -0,0 +1,9 @@
+trait Bug {
+ val u: { type Amb } = ???
+ import u._
+
+ class Amb { def x = 0 }
+ class C(x: Amb) { // after dbd8457e4, "reference to Amb is ambiguous"
+ x.x
+ }
+}