Skip to content

Commit b5abba6

Browse files
committed
inlineContext: assume we never nest empty calls
1 parent 245095d commit b5abba6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,13 +1083,16 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
10831083
private val InlinedCalls = new Property.Key[List[Tree]]
10841084

10851085
/** Record an enclosing inlined call.
1086-
* EmptyTree calls (for parameters) cancel the next-enclosing non-empty call in the list
1086+
* EmptyTree calls (for parameters) cancel the next-enclosing call in the list instead of being added to it.
1087+
* We assume parameters are never nested inside parameters.
10871088
*/
10881089
override def inlineContext(call: Tree)(implicit ctx: Context): Context = {
10891090
// We assume enclosingInlineds is already normalized, and only process the new call with the head.
10901091
val oldIC = enclosingInlineds
10911092
val newIC = (call, oldIC) match {
1092-
case (t, ts1 @ (t1 :: ts2)) if t.isEmpty => if (t1.isEmpty) ts1 else ts2
1093+
case (t, t1 :: ts2) if t.isEmpty =>
1094+
assert(!t1.isEmpty)
1095+
ts2
10931096
case _ => call :: oldIC
10941097
}
10951098
ctx.fresh.setProperty(InlinedCalls, newIC)

0 commit comments

Comments
 (0)