File tree 1 file changed +3
-3
lines changed
compiler/src/dotty/tools/dotc/ast
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -399,9 +399,9 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
399
399
case Apply (fn, args) =>
400
400
def isKnownPureOp (sym : Symbol ) =
401
401
sym.owner.isPrimitiveValueClass || sym.owner == defn.StringClass
402
- if (tree.tpe.isInstanceOf [ConstantType ] && isKnownPureOp(tree.symbol)
403
- // A constant expression with pure arguments is pure.
404
- || fn.symbol.isStable)
402
+ if (tree.tpe.isInstanceOf [ConstantType ] && isKnownPureOp(tree.symbol) // A constant expression with pure arguments is pure.
403
+ || fn.symbol.isStable
404
+ || fn.symbol.isPrimaryConstructor && fn.symbol.owner.isNoInitsClass) // TODO: include in isStable?
405
405
minOf(exprPurity(fn), args.map(exprPurity)) `min` Pure
406
406
else if (fn.symbol.is(Erased )) Pure
407
407
else Impure
You can’t perform that action at this time.
0 commit comments