diff --git a/compiler/src/dotty/tools/dotc/core/Annotations.scala b/compiler/src/dotty/tools/dotc/core/Annotations.scala index f5825df84a8b..0706003f533e 100644 --- a/compiler/src/dotty/tools/dotc/core/Annotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Annotations.scala @@ -65,7 +65,7 @@ object Annotations { if tm.isRange(x) then x else val tp1 = tm(tree.tpe) - foldOver(if !tp1.exists || (tp1 frozen_=:= tree.tpe) then x else tp1, tree) + foldOver(if !tp1.exists || tp1.eql(tree.tpe) then x else tp1, tree) val diff = findDiff(NoType, args) if tm.isRange(diff) then EmptyAnnotation else if diff.exists then derivedAnnotation(tm.mapOver(tree)) diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 5fe6c3174c04..ac6089516571 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -5967,6 +5967,8 @@ object Types extends TypeUtils { override def stopAt = thisMap.stopAt def apply(tp: Type) = f(thisMap(tp)) } + + override def toString = s"${getClass.getSimpleName}@$hashCode" // otherwise would print as } /** A type map that maps also parents and self type of a ClassInfo */ diff --git a/tests/pos-custom-args/captures/setup/a_1.scala b/tests/pos-custom-args/captures/setup/a_1.scala new file mode 100644 index 000000000000..21afde8be3ea --- /dev/null +++ b/tests/pos-custom-args/captures/setup/a_1.scala @@ -0,0 +1,6 @@ +// a.scala +import language.experimental.captureChecking +import scala.caps.CapSet + +trait A: + def f[C^](x: AnyRef^{C^}): Unit diff --git a/tests/pos-custom-args/captures/setup/b_1.scala b/tests/pos-custom-args/captures/setup/b_1.scala new file mode 100644 index 000000000000..d5ba925970ba --- /dev/null +++ b/tests/pos-custom-args/captures/setup/b_1.scala @@ -0,0 +1,5 @@ +import language.experimental.captureChecking +import scala.caps.CapSet + +class B extends A: + def f[C^](x: AnyRef^{C^}): Unit = ??? diff --git a/tests/pos-custom-args/captures/setup/b_2.scala b/tests/pos-custom-args/captures/setup/b_2.scala new file mode 100644 index 000000000000..d5ba925970ba --- /dev/null +++ b/tests/pos-custom-args/captures/setup/b_2.scala @@ -0,0 +1,5 @@ +import language.experimental.captureChecking +import scala.caps.CapSet + +class B extends A: + def f[C^](x: AnyRef^{C^}): Unit = ???