File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -750,13 +750,23 @@ trait Applications extends Compatibility {
750
750
}
751
751
private def sameSeq [T <: Trees .Tree [? ]](xs : List [T ], ys : List [T ]): Boolean = firstDiff(xs, ys) < 0
752
752
753
+ /** An argument is safe if it is a pure expression or a default getter call
754
+ * If all arguments are safe, no reordering is necessary
755
+ */
756
+ def isSafeArg (arg : Tree ) =
757
+ isPureExpr(arg)
758
+ || arg.isInstanceOf [RefTree | Apply | TypeApply ] && arg.symbol.name.is(DefaultGetterName )
759
+
753
760
val result : Tree = {
754
761
var typedArgs = typedArgBuf.toList
755
762
def app0 = cpy.Apply (app)(normalizedFun, typedArgs) // needs to be a `def` because typedArgs can change later
756
763
val app1 =
757
764
if (! success) app0.withType(UnspecifiedErrorType )
758
765
else {
759
- if ! sameSeq(args, orderedArgs) && ! isJavaAnnotConstr(methRef.symbol) then
766
+ if ! sameSeq(args, orderedArgs)
767
+ && ! isJavaAnnotConstr(methRef.symbol)
768
+ && ! typedArgs.forall(isSafeArg)
769
+ then
760
770
// need to lift arguments to maintain evaluation order in the
761
771
// presence of argument reorderings.
762
772
You can’t perform that action at this time.
0 commit comments