@@ -1504,13 +1504,18 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
1504
1504
assert(tree.hasType, tree)
1505
1505
val qual1 = typed(tree.qualifier, shallowSelectionProto(tree.name, pt, this ))
1506
1506
val resNoReduce = untpd.cpy.Select (tree)(qual1, tree.name).withType(tree.typeOpt)
1507
- val resMaybeReduced = constToLiteral(reducer.reduceProjection(resNoReduce))
1508
- if (resNoReduce ne resMaybeReduced)
1509
- typed(resMaybeReduced, pt) // redo typecheck if reduction changed something
1507
+ val reducedProjection = reducer.reduceProjection(resNoReduce)
1508
+ if (reducedProjection.isType)
1509
+ // in case the projection leads to a typed tree, then there is nothing to reduce
1510
+ resNoReduce
1510
1511
else
1511
- val res = resMaybeReduced
1512
- ensureAccessible(res.tpe, tree.qualifier.isInstanceOf [untpd.Super ], tree.srcPos)
1513
- inlineIfNeeded(res)
1512
+ val resMaybeReduced = constToLiteral(reducedProjection)
1513
+ if (resNoReduce ne resMaybeReduced)
1514
+ typed(resMaybeReduced, pt) // redo typecheck if reduction changed something
1515
+ else
1516
+ val res = resMaybeReduced
1517
+ ensureAccessible(res.tpe, tree.qualifier.isInstanceOf [untpd.Super ], tree.srcPos)
1518
+ inlineIfNeeded(res)
1514
1519
}
1515
1520
1516
1521
override def typedIf (tree : untpd.If , pt : Type )(using Context ): Tree =
0 commit comments