aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
-rw-r--r--tests/pos/overloadedAccess.scala18
2 files changed, 19 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index aabcde94d..4c4920e5b 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -138,8 +138,7 @@ class Typer extends Namer with Applications with Implicits {
}
val where = if (ctx.owner.exists) s" from ${ctx.owner.enclosingClass}" else ""
val whyNot = new StringBuffer
- val addendum =
- alts foreach (_.isAccessibleFrom(pre, superAccess, whyNot))
+ alts foreach (_.isAccessibleFrom(pre, superAccess, whyNot))
if (!tpe.isError)
ctx.error(i"$what cannot be accessed as a member of $pre$where.$whyNot", pos)
ErrorType
diff --git a/tests/pos/overloadedAccess.scala b/tests/pos/overloadedAccess.scala
new file mode 100644
index 000000000..a2d72f583
--- /dev/null
+++ b/tests/pos/overloadedAccess.scala
@@ -0,0 +1,18 @@
+object overloadedAccess {
+
+ trait ST {
+ def f(x: Object): Int = 1
+ def f(x: Int): Unit = ()
+ }
+
+ object O extends ST {
+ def f(x: String): Unit = ()
+ }
+
+ class C extends ST {
+ import O._ // needs to pick inherited member because they are made visible in same scope.
+ val x = f("abc")
+ val y: Int = x
+ }
+
+}