Skip to content

Commit daf7eba

Browse files
committed
wip
1 parent 5e342ad commit daf7eba

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
508508
val boundSym = newSym(InlineBinderName.fresh(name.asTermName), bindingFlags, bindingType).asTerm
509509
val binding = {
510510
var newArg = arg.changeOwner(ctx.owner, boundSym)
511-
if argIsBottom && bindingFlags.is(Inline) then
511+
if bindingFlags.is(Inline) && argIsBottom then
512512
newArg = Typed(newArg, TypeTree(formal)) // type ascribe RHS to avoid type errors in expansion. See i8612.scala
513-
else if defn.isTupleNType(formal.widenExpr) && !defn.isTupleNType(argtpe.widen) then
514-
// Also see `argtpe1` above
515-
newArg = Typed(newArg, TypeTree(formal.widenExpr))
516-
517513
if isByName then DefDef(boundSym, newArg)
518514
else ValDef(boundSym, newArg)
519515
}.withSpan(boundSym.span)
@@ -984,21 +980,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
984980
paramProxy.get(tree.tpe) match {
985981
case Some(t) if tree.isTerm && t.isSingleton =>
986982
val inlinedSingleton = singleton(t).withSpan(argSpan)
987-
val tree1 = inlinedFromOutside(inlinedSingleton)(tree.span)
988-
if defn.isTupleNType(tree.tpe.widenTermRefExpr) && !defn.isTupleNType(t.widenTermRefExpr) then
989-
// See tests/pos/i14182b.scala
990-
// FIXME: We have a `tree1` that has a term ref `tup.type` with underlying `1 *: 2 *: EmptyTuple` type but the original reference is to a `Tuple2[Int, Int]`
991-
// If we take the `tree1` then it is impossible to select the `_1` field. If we take the parameter type we can lose singletons references that we should keep.
992-
// Ideally we should ascribe it to a `tup.type & Tuple2[Int, Int]` but that is not working because we have the some special sub-typing rule that makes
993-
// `1 *: 2 *: EmptyTuple <:< Tuple2[Int, Int]`. Therefore the glb of the two types ends up being `tup.type` which drops the extra information we need to add.
994-
// None of the following attempts work.
995-
996-
997-
// tree1.ensureConforms(tree.tpe.widenTermRefExpr)
998-
// Typed(tree1, TypeTree(tree.tpe.widenTermRefExpr & t))
999-
Typed(tree1, TypeTree(AndType(tree.tpe.widenTermRefExpr, t)))
1000-
// tree1.asInstance(AndType(tree.tpe.widenTermRefExpr, t))
1001-
else tree1
983+
inlinedFromOutside(inlinedSingleton)(tree.span)
1002984
case Some(t) if tree.isType =>
1003985
inlinedFromOutside(TypeTree(t).withSpan(argSpan))(tree.span)
1004986
case _ => tree

0 commit comments

Comments
 (0)