Skip to content

Commit 0e94367

Browse files
authored
Merge pull request #194 from scala/backport-lts-3.3-22407
Backport "Fix mapping of annotations" to 3.3 LTS
2 parents 393b003 + 822a29c commit 0e94367

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

compiler/src/dotty/tools/dotc/core/Annotations.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ object Annotations {
6565
if tm.isRange(x) then x
6666
else
6767
val tp1 = tm(tree.tpe)
68-
foldOver(if !tp1.exists || (tp1 frozen_=:= tree.tpe) then x else tp1, tree)
68+
foldOver(if !tp1.exists || tp1.eql(tree.tpe) then x else tp1, tree)
6969
val diff = findDiff(NoType, args)
7070
if tm.isRange(diff) then EmptyAnnotation
7171
else if diff.exists then derivedAnnotation(tm.mapOver(tree))

compiler/src/dotty/tools/dotc/core/Types.scala

+2
Original file line numberDiff line numberDiff line change
@@ -5967,6 +5967,8 @@ object Types extends TypeUtils {
59675967
override def stopAt = thisMap.stopAt
59685968
def apply(tp: Type) = f(thisMap(tp))
59695969
}
5970+
5971+
override def toString = s"${getClass.getSimpleName}@$hashCode" // otherwise would print as <function1>
59705972
}
59715973

59725974
/** A type map that maps also parents and self type of a ClassInfo */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// a.scala
2+
import language.experimental.captureChecking
3+
import scala.caps.CapSet
4+
5+
trait A:
6+
def f[C^](x: AnyRef^{C^}): Unit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import language.experimental.captureChecking
2+
import scala.caps.CapSet
3+
4+
class B extends A:
5+
def f[C^](x: AnyRef^{C^}): Unit = ???
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import language.experimental.captureChecking
2+
import scala.caps.CapSet
3+
4+
class B extends A:
5+
def f[C^](x: AnyRef^{C^}): Unit = ???

0 commit comments

Comments
 (0)