Skip to content

Commit caf62de

Browse files
Do not normalizedType in the default code path
1 parent cbfe46d commit caf62de

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,9 @@ trait TypeAssigner {
376376
val tpe =
377377
if (fntpe.isResultDependent) safeSubstParams(fntpe.resultType, fntpe.paramRefs, args.tpes)
378378
else fntpe.resultType
379-
val tpe1 =
380-
if (!ctx.erasedTypes && (fn.symbol.isDependentMethod || ctx.isDependent)) TypeOf(tpe, tree)
381-
else tpe
382-
ctx.normalizedType(tpe1)
379+
if (!ctx.erasedTypes && (fn.symbol.isDependentMethod || ctx.isDependent))
380+
ctx.normalizedType(TypeOf(tpe, tree))
381+
else tpe
383382
} else
384383
errorType(i"wrong number of arguments at ${ctx.phase.prev} for $fntpe: ${fn.tpe}, expected: ${fntpe.paramInfos.length}, found: ${args.length}", tree.pos)
385384
case t =>
@@ -439,10 +438,9 @@ trait TypeAssigner {
439438
val argTypes = args.tpes
440439
if (sameLength(argTypes, paramNames)) {
441440
val tpe = pt.instantiate(argTypes)
442-
val tpe1 =
443-
if (!ctx.erasedTypes && (fn.symbol.isDependentMethod || ctx.isDependent)) TypeOf(tpe, tree)
444-
else tpe
445-
ctx.normalizedType(tpe1)
441+
if (!ctx.erasedTypes && (fn.symbol.isDependentMethod || ctx.isDependent))
442+
ctx.normalizedType(TypeOf(tpe, tree))
443+
else tpe
446444
}
447445
else wrongNumberOfTypeArgs(fn.tpe, pt.typeParams, args, tree.pos)
448446
}
@@ -517,13 +515,13 @@ trait TypeAssigner {
517515
if (TypeOf.isLegalTopLevelTree(ref))
518516
if (ref.tpe.isInstanceOf[TypeOf] ||
519517
ref.tpe.isInstanceOf[ConstantType]) // Can happen because of typer's constant folding
520-
ref.tpe
518+
ctx.normalizedType(ref.tpe)
521519
else
522520
errorType(i"Non-sensical singleton-type expression: $ref: ${ref.tpe}", ref.pos)
523521
else
524522
throw new AssertionError(i"Tree $ref is not a valid reference for a singleton type tree.")
525523
}
526-
tree.withType(ctx.normalizedType(tp))
524+
tree.withType(tp)
527525
}
528526

529527
def assignType(tree: untpd.AndTypeTree, left: Tree, right: Tree)(implicit ctx: Context) =

0 commit comments

Comments
 (0)