From 0226345811636d05d67bbd574829df1515dff136 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 13 Mar 2014 09:35:37 +0100 Subject: 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`. --- test/files/pos/t8403.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/files/pos/t8403.scala (limited to 'test/files/pos/t8403.scala') 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 + } +} -- cgit v1.2.3