Skip to content

Commit

Permalink
Debugging session with Hamza
Browse files Browse the repository at this point in the history
  • Loading branch information
bracevac committed Aug 6, 2024
1 parent 14c85dd commit a12e58a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions tests/neg/i18446/Foo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package foo;

public class Foo {
protected static void foo(String x) { }

public static void foo(Object x) { }
}
10 changes: 9 additions & 1 deletion tests/neg/i18446/Test.scala
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit a12e58a

Please sign in to comment.