Skip to content

Commit a8a7037

Browse files
committed
Disallow phase inconsitent inline parameters
1 parent 54ab00e commit a8a7037

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
8888
tree match {
8989
case Quoted(_) | Spliced(_) =>
9090
tree
91-
case tree: RefTree if tree.symbol.isAllOf(InlineParam) =>
92-
tree
9391
case _: This =>
9492
assert(checkSymLevel(tree.symbol, tree.tpe, tree.sourcePos).isEmpty)
9593
tree
@@ -197,10 +195,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
197195
case Some(l) =>
198196
l == level ||
199197
level == -1 && (
200-
// here we assume that Splicer.canBeSpliced was true before going to level -1,
201-
// this implies that all non-inline arguments are quoted and that the following two cases are checked
202-
// on inline parameters or type parameters.
203-
sym.is(Param) ||
198+
// TODO: Is this still needed?
204199
sym.isClass // reference to this in inline methods
205200
)
206201
case None =>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import dotty.tools.dotc.util.Spans._
1919
import dotty.tools.dotc.util.{Property, SourcePosition}
2020
import dotty.tools.dotc.transform.SymUtils._
2121
import dotty.tools.dotc.typer.Implicits.SearchFailureType
22-
import dotty.tools.dotc.typer.Inliner
2322

2423
import scala.collection.mutable
2524
import scala.annotation.constructorOnly
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.quoted._
2+
3+
inline def old(inline x: Int): Int =
4+
${ oldImpl(x) } // error
5+
6+
private def oldImpl(x: Int): Expr[Int] = ???
7+
8+
inline def `new`(inline x: Int): Int =
9+
${ newImpl('x) }
10+
11+
private def newImpl(x: Expr[Int]): Expr[Int] = ???

0 commit comments

Comments
 (0)