File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -5736,6 +5736,12 @@ object Types {
57365736 case tp @ SuperType (thistp, supertp) =>
57375737 derivedSuperType(tp, this (thistp), this (supertp))
57385738
5739+ case tp @ ConstantType (const @ Constant (_ : Type )) =>
5740+ val classType = const.tpe
5741+ val classType1 = this (classType)
5742+ if classType eq classType1 then tp
5743+ else classType1
5744+
57395745 case tp : LazyRef =>
57405746 LazyRef { refCtx =>
57415747 given Context = refCtx
Original file line number Diff line number Diff line change @@ -71,6 +71,16 @@ object Formatting {
7171 given Show [TypeComparer .ApproxState ] with
7272 def show (x : TypeComparer .ApproxState ) = TypeComparer .ApproxState .Repr .show(x)
7373
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+
7484 given Show [Showable ] = ShowAny
7585 given Show [Shown ] = ShowAny
7686 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