File tree Expand file tree Collapse file tree 5 files changed +28
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 5 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -578,8 +578,9 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
578578 sym.owner.isPrimitiveValueClass
579579 || sym.owner == defn.StringClass
580580 || defn.pureMethods.contains(sym)
581+
581582 tree.tpe.isInstanceOf [ConstantType ] && tree.symbol != NoSymbol && isKnownPureOp(tree.symbol) // A constant expression with pure arguments is pure.
582- || fn.symbol.isStableMember && ! fn.symbol.is( Lazy ) // constructors of no-inits classes are stable
583+ || fn.symbol.isStableMember && fn.symbol.isConstructor // constructors of no-inits classes are stable
583584
584585 /** The purity level of this reference.
585586 * @return
Original file line number Diff line number Diff line change 1+ hello world
Original file line number Diff line number Diff line change 1+ object foo {
2+ object HelloGen {
3+ println(" hello world" )
4+ }
5+ val Hello = HelloGen
6+ }
7+
8+ import foo .Hello
9+
10+ object Test {
11+ def main (args : Array [String ]): Unit = Hello : Unit
12+ }
Original file line number Diff line number Diff line change 1+ hello world
Original file line number Diff line number Diff line change 1+ package object foo {
2+ object HelloGen {
3+ println(" hello world" )
4+ }
5+ val Hello = HelloGen
6+ }
7+
8+ import foo .Hello
9+
10+ object Test {
11+ def main (args : Array [String ]): Unit = Hello : Unit
12+ }
You can’t perform that action at this time.
0 commit comments