diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 3904228756a0..11f74da3bc01 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -2183,7 +2183,10 @@ object SymDenotations { val pre1 = pre match case pre: OrType => pre.widenUnion case _ => pre - raw.filterWithFlags(required, excluded).asSeenFrom(pre1).toDenot(pre1) + if name == "bar".toTermName then println(s"raw: $raw") + val res = raw.filterWithFlags(required, excluded).asSeenFrom(pre1).toDenot(pre1) + if name == "bar".toTermName then println(i"res: $res") + res final def findMemberNoShadowingBasedOnFlags(name: Name, pre: Type, required: FlagSet = EmptyFlags, excluded: FlagSet = EmptyFlags)(using Context): Denotation = diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index dca8bf206bac..4aa93fa31754 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -2205,7 +2205,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling /** Defer constraining type variables when compared against prototypes */ def isMatchedByProto(proto: ProtoType, tp: Type): Boolean = tp.stripTypeVar match { case tp: TypeParamRef if constraint contains tp => true - case _ => proto.isMatchedBy(tp, keepConstraint = true) + case _ => + println(i"proto: $proto") + println(i"tp: $tp") + proto.isMatchedBy(tp, keepConstraint = true) } /** Narrow gadt.bounds for the type parameter referenced by `tr` to include diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index c518de7dbbfe..b3f68c71258d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -3993,6 +3993,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer // get all the alternatives val altDenots = val allDenots = ref.denot.alternatives + println(i"tree.symbol.id: ${tree.symbol.id}") + println(i"ref: $ref") if pt.isExtensionApplyProto then allDenots.filter(_.symbol.is(ExtensionMethod)) else allDenots @@ -4660,6 +4662,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer case _ => NoType case _ => NoType + println(i"tree.tpe.widen: ${tree.tpe.widen}") + println(i"tree.tpe: ${tree.tpe}") tree match { case _: MemberDef | _: PackageDef | _: Import | _: WithoutTypeOrPos[?] | _: Closure => tree case _ => tree.tpe.widen match { diff --git a/tests/neg/i18446/Foo.java b/tests/neg/i18446/Foo.java new file mode 100644 index 000000000000..368c9b4166bb --- /dev/null +++ b/tests/neg/i18446/Foo.java @@ -0,0 +1,7 @@ +package foo; + +public class Foo { + protected static void foo(String x) { } + + public static void foo(Object x) { } +} diff --git a/tests/neg/i18446/Test.scala b/tests/neg/i18446/Test.scala index b0932061cf54..8a5489e115bb 100644 --- a/tests/neg/i18446/Test.scala +++ b/tests/neg/i18446/Test.scala @@ -1 +1,9 @@ -val _ = foo.Task.poll() // error +//val _ = foo.Task.poll() // error +val _ = foo.Foo.foo("hai") // error, when it shouldn't + +class Bar: + private def bar(x: String): Unit = () + def bar(x: Any): Unit = () + def bar(x: Int): Unit = () + +val _ = Bar().bar("hai") \ No newline at end of file