Skip to content

Commit 5ccec02

Browse files
committed
PostTyper#normalizeTypeArgs: fast path to avoid allocations
According to -Yprofile-enabled, this reduces the amount of memory allocated in PostTyper when compiling re2s from 39 MB to 26 MB
1 parent e97ae33 commit 5ccec02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
150150
}
151151
val (tycon, args) = decompose(tree)
152152
tycon.tpe.widen match {
153-
case tp: PolyType =>
153+
case tp: PolyType if args.exists(isNamedArg) =>
154154
val (namedArgs, otherArgs) = args.partition(isNamedArg)
155155
val args1 = reorderArgs(tp.paramNames, namedArgs.asInstanceOf[List[NamedArg]], otherArgs)
156156
TypeApply(tycon, args1).withPos(tree.pos).withType(tree.tpe)

0 commit comments

Comments
 (0)