aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
-rw-r--r--tests/pos/t2133.scala18
2 files changed, 20 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index f4b52ce09..944b44510 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -70,6 +70,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
* (3) Change pattern Idents id (but not wildcards) to id @ _
*/
def typedIdent(tree: untpd.Ident, pt: Type)(implicit ctx: Context): Tree = track("typedIdent") {
+ val refctx = ctx
val name = tree.name
/** Method is necessary because error messages need to bind to
@@ -179,7 +180,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
if (imp.isWildcardImport) {
val pre = imp.site
if (!isDisabled(imp, pre) && !(imp.excluded contains name.toTermName)) {
- val denot = pre.member(name)
+ val denot = pre.member(name).accessibleFrom(pre)(refctx)
if (reallyExists(denot)) return pre.select(name, denot)
}
}
diff --git a/tests/pos/t2133.scala b/tests/pos/t2133.scala
new file mode 100644
index 000000000..02ef43c21
--- /dev/null
+++ b/tests/pos/t2133.scala
@@ -0,0 +1,18 @@
+trait Foo {
+ object bar {
+ private def fn() = 5
+ }
+}
+
+trait Foo2 {
+ object bip {
+ def fn() = 10
+ }
+}
+
+class Bob extends AnyRef with Foo with Foo2 {
+ import bip._
+ import bar._
+
+ def go() = fn()
+}