File tree 3 files changed +34
-0
lines changed
compiler/src/dotty/tools/dotc
3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -5735,6 +5735,12 @@ object Types {
5735
5735
case tp @ SuperType (thistp, supertp) =>
5736
5736
derivedSuperType(tp, this (thistp), this (supertp))
5737
5737
5738
+ case tp @ ConstantType (const @ Constant (_ : Type )) =>
5739
+ val classType = const.tpe
5740
+ val classType1 = this (classType)
5741
+ if classType eq classType1 then tp
5742
+ else classType1
5743
+
5738
5744
case tp : LazyRef =>
5739
5745
LazyRef { refCtx =>
5740
5746
given Context = refCtx
Original file line number Diff line number Diff line change @@ -71,6 +71,16 @@ object Formatting {
71
71
given Show [TypeComparer .ApproxState ] with
72
72
def show (x : TypeComparer .ApproxState ) = TypeComparer .ApproxState .Repr .show(x)
73
73
74
+ given Show [ast.TreeInfo .PurityLevel ] with
75
+ def show (x : ast.TreeInfo .PurityLevel ) = x match
76
+ case ast.TreeInfo .Path => " PurityLevel.Path"
77
+ case ast.TreeInfo .Pure => " PurityLevel.Pure"
78
+ case ast.TreeInfo .Idempotent => " PurityLevel.Idempotent"
79
+ case ast.TreeInfo .Impure => " PurityLevel.Impure"
80
+ case ast.TreeInfo .PurePath => " PurityLevel.PurePath"
81
+ case ast.TreeInfo .IdempotentPath => " PurityLevel.IdempotentPath"
82
+ case _ => s " PurityLevel( ${x.x}) "
83
+
74
84
given Show [Showable ] = ShowAny
75
85
given Show [Shown ] = ShowAny
76
86
given Show [Int ] = ShowAny
Original file line number Diff line number Diff line change
1
+ class Test :
2
+ def test =
3
+ classOf [Test ]
4
+
5
+ def blck =
6
+ class Blck
7
+ val cls = classOf [Blck ]
8
+ cls
9
+
10
+ def expr =
11
+ class Expr
12
+ classOf [Expr ] // was: "assertion failed: leak: Expr in { [..] }" crash
13
+
14
+ object Test extends Test :
15
+ def main (args : Array [String ]): Unit =
16
+ assert(test.getName == " Test" , test.getName)
17
+ assert(blck.getName == " Test$Blck$1" , blck.getName)
18
+ assert(expr.getName == " Test$Expr$1" , expr.getName)
You can’t perform that action at this time.
0 commit comments