diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 0890e22a9aa2..f2a63e5ec943 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -71,7 +71,7 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro * of all children to the right. */ def envelope(src: SourceFile, startSpan: Span = NoSpan): Span = this match { - case Trees.Inlined(call, _, _) => + case Trees.Inlined(call, _) => call.span case _ => def include(span: Span, x: Any): Span = x match { diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala index 8d0691037795..95113df81410 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -401,8 +401,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => exprPurity(expr) case Block(stats, expr) => minOf(exprPurity(expr), stats.map(statPurity)) - case Inlined(_, bindings, expr) => - minOf(exprPurity(expr), bindings.map(statPurity)) + case Inlined(_, expr) => + exprPurity(expr) case NamedArg(_, expr) => exprPurity(expr) case _ => @@ -599,7 +599,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => Some(meth) case Block(Nil, expr) => unapply(expr) - case Inlined(_, bindings, expr) if bindings.forall(isPureBinding) => + case Inlined(_, expr) => unapply(expr) case _ => None @@ -728,7 +728,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => */ def tupleArgs(tree: Tree)(implicit ctx: Context): List[Tree] = tree match { case Block(Nil, expr) => tupleArgs(expr) - case Inlined(_, Nil, expr) => tupleArgs(expr) + case Inlined(_, expr) => tupleArgs(expr) case Apply(fn, args) if fn.symbol.name == nme.apply && fn.symbol.owner.is(Module) && diff --git a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala index 43643465f762..22367f230979 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -106,10 +106,9 @@ class TreeTypeMap( val (tmap1, stats1) = transformDefs(stats) val expr1 = tmap1.transform(expr) cpy.Block(blk)(stats1, expr1) - case inlined @ Inlined(call, bindings, expanded) => - val (tmap1, bindings1) = transformDefs(bindings) - val expanded1 = tmap1.transform(expanded) - cpy.Inlined(inlined)(call, bindings1, expanded1) + case inlined @ Inlined(call, expanded) => + val expanded1 = transform(expanded) + cpy.Inlined(inlined)(call, expanded1) case cdef @ CaseDef(pat, guard, rhs) => val tmap = withMappedSyms(patVars(pat)) val pat1 = tmap.transform(pat) diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 8226c6b19133..485f20c59649 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -590,18 +590,9 @@ object Trees { * @param call Info about the original call that was inlined * Until PostTyper, this is the full call, afterwards only * a reference to the toplevel class from which the call was inlined. - * @param bindings Bindings for proxies to be used in the inlined code - * @param expansion The inlined tree, minus bindings. - * - * The full inlined code is equivalent to - * - * { bindings; expansion } - * - * The reason to keep `bindings` separate is because they are typed in a - * different context: `bindings` represent the arguments to the inlined - * call, whereas `expansion` represents the body of the inlined function. + * @param expansion The inlined tree, including bindings. */ - case class Inlined[-T >: Untyped] private[ast] (call: tpd.Tree, bindings: List[MemberDef[T]], expansion: Tree[T])(implicit @constructorOnly src: SourceFile) + case class Inlined[-T >: Untyped] private[ast] (call: tpd.Tree, expansion: Tree[T])(implicit @constructorOnly src: SourceFile) extends Tree[T] { type ThisTree[-T >: Untyped] = Inlined[T] } @@ -1080,9 +1071,9 @@ object Trees { case tree: SeqLiteral if (elems eq tree.elems) && (elemtpt eq tree.elemtpt) => tree case _ => finalize(tree, untpd.SeqLiteral(elems, elemtpt)(sourceFile(tree))) } - def Inlined(tree: Tree)(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree)(implicit ctx: Context): Inlined = tree match { - case tree: Inlined if (call eq tree.call) && (bindings eq tree.bindings) && (expansion eq tree.expansion) => tree - case _ => finalize(tree, untpd.Inlined(call, bindings, expansion)(sourceFile(tree))) + def Inlined(tree: Tree)(call: tpd.Tree, expansion: Tree)(implicit ctx: Context): Inlined = tree match { + case tree: Inlined if (call eq tree.call) && (expansion eq tree.expansion) => tree + case _ => finalize(tree, untpd.Inlined(call, expansion)(sourceFile(tree))) } def SingletonTypeTree(tree: Tree)(ref: Tree)(implicit ctx: Context): SingletonTypeTree = tree match { case tree: SingletonTypeTree if (ref eq tree.ref) => tree @@ -1243,8 +1234,8 @@ object Trees { cpy.Try(tree)(transform(block), transformSub(cases), transform(finalizer)) case SeqLiteral(elems, elemtpt) => cpy.SeqLiteral(tree)(transform(elems), transform(elemtpt)) - case Inlined(call, bindings, expansion) => - cpy.Inlined(tree)(call, transformSub(bindings), transform(expansion)(inlineContext(call))) + case Inlined(call, expansion) => + cpy.Inlined(tree)(call, transform(expansion)(inlineContext(call))) case TypeTree() => tree case SingletonTypeTree(ref) => @@ -1367,8 +1358,8 @@ object Trees { this(this(this(x, block), handler), finalizer) case SeqLiteral(elems, elemtpt) => this(this(x, elems), elemtpt) - case Inlined(call, bindings, expansion) => - this(this(x, bindings), expansion)(inlineContext(call)) + case Inlined(call, expansion) => + this(x, expansion)(inlineContext(call)) case TypeTree() => x case SingletonTypeTree(ref) => diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 9d786d21c44c..78c38dbb21f7 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -152,8 +152,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit ctx: Context): JavaSeqLiteral = ta.assignType(new untpd.JavaSeqLiteral(elems, elemtpt), elems, elemtpt).asInstanceOf[JavaSeqLiteral] - def Inlined(call: Tree, bindings: List[MemberDef], expansion: Tree)(implicit ctx: Context): Inlined = - ta.assignType(untpd.Inlined(call, bindings, expansion), bindings, expansion) + def Inlined(call: Tree, expansion: Tree)(implicit ctx: Context): Inlined = + ta.assignType(untpd.Inlined(call, expansion), expansion) def TypeTree(tp: Type)(implicit ctx: Context): TypeTree = untpd.TypeTree().withType(tp) @@ -643,12 +643,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { } } - override def Inlined(tree: Tree)(call: Tree, bindings: List[MemberDef], expansion: Tree)(implicit ctx: Context): Inlined = { - val tree1 = untpdCpy.Inlined(tree)(call, bindings, expansion) + override def Inlined(tree: Tree)(call: Tree, expansion: Tree)(implicit ctx: Context): Inlined = { + val tree1 = untpdCpy.Inlined(tree)(call, expansion) tree match { - case tree: Inlined if sameTypes(bindings, tree.bindings) && (expansion.tpe eq tree.expansion.tpe) => + case tree: Inlined if expansion.tpe eq tree.expansion.tpe => tree1.withTypeUnchecked(tree.tpe) - case _ => ta.assignType(tree1, bindings, expansion) + case _ => ta.assignType(tree1, expansion) } } @@ -1023,7 +1023,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { case defTree: ValOrDefDef => transform(defTree.rhs) case _ => tree } - case Inlined(_, _, arg) => transform(arg) + case Inlined(_, arg) => transform(arg) case Block(Nil, arg) => transform(arg) case NamedArg(_, arg) => transform(arg) case tree => super.transform(tree) diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala index d31b368873d5..c1cb1ee93897 100644 --- a/compiler/src/dotty/tools/dotc/ast/untpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala @@ -305,7 +305,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def Try(expr: Tree, cases: List[CaseDef], finalizer: Tree)(implicit src: SourceFile): Try = new Try(expr, cases, finalizer) def SeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): SeqLiteral = new SeqLiteral(elems, elemtpt) def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): JavaSeqLiteral = new JavaSeqLiteral(elems, elemtpt) - def Inlined(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree)(implicit src: SourceFile): Inlined = new Inlined(call, bindings, expansion) + def Inlined(call: tpd.Tree, expansion: Tree)(implicit src: SourceFile): Inlined = new Inlined(call, expansion) def TypeTree()(implicit src: SourceFile): TypeTree = new TypeTree() def SingletonTypeTree(ref: Tree)(implicit src: SourceFile): SingletonTypeTree = new SingletonTypeTree(ref) def RefinedTypeTree(tpt: Tree, refinements: List[Tree])(implicit src: SourceFile): RefinedTypeTree = new RefinedTypeTree(tpt, refinements) diff --git a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala index a3e83220f91f..52df83cc7962 100644 --- a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala @@ -131,9 +131,9 @@ object PickledQuotes { val argVals = args.map(arg => SyntheticValDef(NameKinds.UniqueName.fresh("x".toTermName), arg).withSpan(arg.span)) def argRefs() = argVals.map(argVal => ref(argVal.symbol)) def rec(fn: Tree): Tree = fn match { - case Inlined(call, bindings, expansion) => + case Inlined(call, expansion) => // this case must go before closureDef to avoid dropping the inline node - cpy.Inlined(fn)(call, bindings, rec(expansion)) + cpy.Inlined(fn)(call, rec(expansion)) case closureDef(ddef) => val paramSyms = ddef.vparamss.head.map(param => param.symbol) val paramToVals = paramSyms.zip(argRefs()).toMap diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index e853ded1ad13..41bc5a3d7843 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -86,7 +86,7 @@ Standard-Section: "ASTs" TopLevelStat* TYPED Length expr_Term ascriptionType_Tern ASSIGN Length lhs_Term rhs_Term BLOCK Length expr_Term Stat* - INLINED Length expr_Term call_Term? ValOrDefDef* + INLINED Length expr_Term call_Term? LAMBDA Length meth_Term target_Type? IF Length [INLINE] cond_Term then_Term else_Term MATCH Length (IMPLICIT | [INLINE] sel_Term) CaseDef* @@ -244,7 +244,7 @@ Standard Section: "Comments" Comment* object TastyFormat { final val header: Array[Int] = Array(0x5C, 0xA1, 0xAB, 0x1F) - val MajorVersion: Int = 13 + val MajorVersion: Int = 14 val MinorVersion: Int = 0 /** Tags used to serialize names */ diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 1cbe5d3a9581..09de23e36936 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -458,16 +458,11 @@ class TreePickler(pickler: TastyPickler) { case SeqLiteral(elems, elemtpt) => writeByte(REPEATED) withLength { pickleTree(elemtpt); elems.foreach(pickleTree) } - case Inlined(call, bindings, expansion) => + case Inlined(call, expansion) => writeByte(INLINED) - bindings.foreach(preRegister) withLength { pickleTree(expansion) if (!call.isEmpty) pickleTree(call) - bindings.foreach { b => - assert(b.isInstanceOf[DefDef] || b.isInstanceOf[ValDef]) - pickleTree(b) - } } case Bind(name, body) => registerDef(tree.symbol) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index ef22e72bc82d..2a1a3f96e4ae 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -1106,9 +1106,8 @@ class TreeUnpickler(reader: TastyReader, case _ => readTerm() } val call = ifBefore(end)(maybeCall, EmptyTree) - val bindings = readStats(ctx.owner, end).asInstanceOf[List[ValOrDefDef]] - val expansion = exprReader.readTerm() // need bindings in scope, so needs to be read before - Inlined(call, bindings, expansion) + val expansion = exprReader.readTerm() + Inlined(call, expansion) case IF => if (nextByte == INLINE) { readByte() diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 8f28c9d1f87d..19cb1a73e48c 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -415,10 +415,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { } case SeqLiteral(elems, elemtpt) => "[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]" - case tree @ Inlined(call, bindings, body) => + case tree @ Inlined(call, body) => (("/* inlined from " ~ (if (call.isEmpty) "outside" else toText(call)) ~ " */ ") `provided` !homogenizedView && !ctx.settings.YshowNoInline.value) ~ - blockText(bindings :+ body) + toText(body) case tpt: untpd.DerivedTypeTree => "" case TypeTree() => diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala index 9d45383d6827..84e1330d8975 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala @@ -370,7 +370,7 @@ private class ExtractDependenciesCollector extends tpd.TreeTraverser { thisTreeT } tree match { - case Inlined(call, _, _) if !call.isEmpty => + case Inlined(call, _) if !call.isEmpty => // The inlined call is normally ignored by TreeTraverser but we need to // record it as a dependency traverse(call) diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala index 46de01ae1a4a..888a64c2d9c1 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala @@ -477,14 +477,13 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } def Inlined_call(self: Inlined)(implicit ctx: Context): Option[Tree /* Term | TypeTree */] = optional(self.call) - def Inlined_bindings(self: Inlined)(implicit ctx: Context): List[Definition] = self.bindings def Inlined_body(self: Inlined)(implicit ctx: Context): Term = self.expansion - def Inlined_apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = - withDefaultPos(ctx => tpd.Inlined(call.getOrElse(tpd.EmptyTree), bindings.map { case b: tpd.MemberDef => b }, expansion)(ctx)) + def Inlined_apply(call: Option[Tree /* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined = + withDefaultPos(ctx => tpd.Inlined(call.getOrElse(tpd.EmptyTree), expansion)(ctx)) - def Inlined_copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = - tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), bindings.asInstanceOf[List[tpd.MemberDef]], expansion) + def Inlined_copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined = + tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), expansion) type Lambda = tpd.Closure diff --git a/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala b/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala index c42e6e1b7132..4a0e57711a06 100644 --- a/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala +++ b/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala @@ -365,9 +365,8 @@ class MegaPhase(val miniPhases: Array[MiniPhase]) extends Phase { goTry(cpy.Try(tree)(expr, cases, finalizer), start) case tree: Inlined => implicit val ctx = prepInlined(tree, start)(outerCtx) - val bindings = transformSpecificTrees(tree.bindings, start) val expansion = transformTree(tree.expansion, start)(inlineContext(tree.call)) - goInlined(cpy.Inlined(tree)(tree.call, bindings, expansion), start) + goInlined(cpy.Inlined(tree)(tree.call, expansion), start) case tree: Return => implicit val ctx = prepReturn(tree, start)(outerCtx) val expr = transformTree(tree.expr, start) diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index 3749f73b6bbe..ac00c0b8541d 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -169,8 +169,8 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase private object dropInlines extends TreeMap { override def transform(tree: Tree)(implicit ctx: Context): Tree = tree match { - case Inlined(call, _, _) => - cpy.Inlined(tree)(call, Nil, Typed(ref(defn.Predef_undefined), TypeTree(tree.tpe))) + case Inlined(call, _) => + cpy.Inlined(tree)(call, Typed(ref(defn.Predef_undefined), TypeTree(tree.tpe))) case _ => super.transform(tree) } } @@ -223,9 +223,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase case _ => super.transform(tree1) } - case Inlined(call, bindings, expansion) if !call.isEmpty => + case Inlined(call, expansion) if !call.isEmpty => val callTrace = Inliner.inlineCallTrace(call.symbol, call.sourcePos) - cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion)(inlineContext(call))) + cpy.Inlined(tree)(callTrace, transform(expansion)(inlineContext(call))) case tree: Template => withNoCheckNews(tree.parents.flatMap(newPart)) { val templ1 = paramFwd.forwardParamAccessors(tree) diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala index df6f73e623ea..85554edc9c58 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala @@ -185,7 +185,7 @@ class ReifyQuotes extends MacroTransform { if (level == 0 && !ctx.inInlineMethod) { val body2 = if (body1.isType) body1 - else Inlined(Inliner.inlineCallTrace(ctx.owner, quote.sourcePos), Nil, body1) + else Inlined(Inliner.inlineCallTrace(ctx.owner, quote.sourcePos), body1) pickledQuote(body2, splices, body.tpe, isType).withSpan(quote.span) } else { @@ -240,7 +240,7 @@ class ReifyQuotes extends MacroTransform { // Note that lifted trees are not necessarily expressions and that Inlined nodes are expected to be expressions. // For example we can have a lifted tree containing the LHS of an assignment (see tests/run-with-compiler/quote-var.scala). if (splice.isType || outer.embedded.isLiftedSymbol(body.symbol)) hole - else Inlined(EmptyTree, Nil, hole).withSpan(splice.span) + else Inlined(EmptyTree, hole).withSpan(splice.span) } } @@ -311,7 +311,7 @@ class ReifyQuotes extends MacroTransform { enclosingInlineds match { case enclosingInline :: _ => // In case a tree was inlined inside of the quote and we this closure corresponds to code within it we need to keep the inlined node. - Inlined(enclosingInline, Nil, closure)(ctx.withSource(lambdaOwner.topLevelClass.source)) + Inlined(enclosingInline, closure)(ctx.withSource(lambdaOwner.topLevelClass.source)) case Nil => closure } } @@ -387,14 +387,13 @@ class ReifyQuotes extends MacroTransform { object ReifyQuotes { - import tpd._ val name: String = "reifyQuotes" def toValue(tree: tpd.Tree): Option[Any] = tree match { case Literal(Constant(c)) => Some(c) case Block(Nil, e) => toValue(e) - case Inlined(_, Nil, e) => toValue(e) + case Inlined(_, e) => toValue(e) case _ => None } diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index 704c44f41a1c..80cbca4bd05e 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -95,7 +95,7 @@ object Splicer { } protected def interpretQuote(tree: Tree)(implicit env: Env): Object = - new scala.quoted.Exprs.TastyTreeExpr(Inlined(EmptyTree, Nil, tree).withSpan(tree.span)) + new scala.quoted.Exprs.TastyTreeExpr(Inlined(EmptyTree, tree).withSpan(tree.span)) protected def interpretTypeQuote(tree: Tree)(implicit env: Env): Object = new scala.quoted.Types.TreeType(tree) @@ -312,7 +312,7 @@ object Splicer { case quoted: Ident if quoted.symbol.is(InlineByNameProxy) => // inline proxy for by-name parameter quoted.symbol.defTree.asInstanceOf[DefDef].rhs - case Inlined(EmptyTree, _, quoted) => quoted + case Inlined(EmptyTree, quoted) => quoted case _ => quoted } interpretQuote(quoted1) @@ -356,7 +356,7 @@ object Splicer { interpretTree(expr)(newEnv) case NamedArg(_, arg) => interpretTree(arg) - case Inlined(EmptyTree, Nil, expansion) => interpretTree(expansion) + case Inlined(EmptyTree, expansion) => interpretTree(expansion) case Typed(expr, _) => interpretTree(expr) diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala index e4d71a68488a..8841046d2be6 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -410,9 +410,6 @@ class TreeChecker extends Phase with SymTransformer { override def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context): Tree = withDefinedSyms(tree.stats) { super.typedBlock(tree, pt) } - override def typedInlined(tree: untpd.Inlined, pt: Type)(implicit ctx: Context): Tree = - withDefinedSyms(tree.bindings) { super.typedInlined(tree, pt) } - /** Check that all defined symbols have legal owners. * An owner is legal if it is either the same as the context's owner * or there's an owner chain of valdefs starting at the context's owner and diff --git a/compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala b/compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala index 12ac4b6240c0..f78e430210da 100644 --- a/compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala +++ b/compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala @@ -34,16 +34,14 @@ class YCheckPositions extends Phases.Phase { } } - // Recursivlely check children while keeping track of current source + // Recursively check children while keeping track of current source tree match { - case Inlined(EmptyTree, bindings, expansion) => - assert(bindings.isEmpty) + case Inlined(EmptyTree, expansion) => val old = sources sources = old.tail traverse(expansion)(inlineContext(EmptyTree)) sources = old - case Inlined(call, bindings, expansion) => - bindings.foreach(traverse(_)) + case Inlined(call, expansion) => sources = call.symbol.topLevelClass.source :: sources if (!isMacro(call)) // FIXME macro implementations can drop Inlined nodes. We should reinsert them after macro expansion based on the positions of the trees traverse(expansion)(inlineContext(call)) diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 6e9f2d016ea8..31a60c9734ea 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -1123,7 +1123,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => def unapplyImplicits(unapp: Tree): List[Tree] = unapp match { case Apply(Apply(unapply, `dummyArg` :: Nil), args2) => assert(args2.nonEmpty); args2 case Apply(unapply, `dummyArg` :: Nil) => Nil - case Inlined(u, _, _) => unapplyImplicits(u) + case Inlined(u, _) => unapplyImplicits(u) case _ => Nil.assertingErrorsReported } @@ -1826,7 +1826,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => ctx.addMode(Mode.SynthesizeExtMethodReceiver)) val appSym = app match { - case Inlined(call, _, _) => call.symbol + case Inlined(call, _) => call.symbol case _ => app.symbol } if (!appSym.is(Extension)) diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 772668f897e1..851d7cf1cbd5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -70,7 +70,7 @@ object Inliner { def liftFromInlined(call: Tree) = new TreeMap { override def transform(t: Tree)(implicit ctx: Context) = { t match { - case Inlined(t, Nil, expr) if t.isEmpty => expr + case Inlined(t, expr) if t.isEmpty => expr case _ => super.transform(t.withSpan(call.span)) } } @@ -86,10 +86,8 @@ object Inliner { case Block(stats, expr) => bindings ++= stats.map(liftPos) liftBindings(expr, liftPos) - case Inlined(call, stats, expr) => - bindings ++= stats.map(liftPos) - val lifter = liftFromInlined(call) - cpy.Inlined(tree)(call, Nil, liftBindings(expr, liftFromInlined(call).transform(_))) + case Inlined(call, expr) => + cpy.Inlined(tree)(call, liftBindings(expr, liftFromInlined(call).transform(_))) case Apply(fn, args) => cpy.Apply(tree)(liftBindings(fn, liftPos), args) case TypeApply(fn, args) => @@ -156,7 +154,7 @@ object Inliner { override def transform(tree: Tree)(implicit ctx: Context): Tree = { val transformed = reposition(tree match { case tree: Inlined => - tpd.seq(transformSub(tree.bindings), transform(tree.expansion)(inlineContext(tree.call)))(ctx.withSource(curSource)) : Tree + transform(tree.expansion)(inlineContext(tree.call)) case tree: Ident => finalize(tree, untpd.Ident(tree.name)(curSource)) case tree: Literal => finalize(tree, untpd.Literal(tree.const)(curSource)) case tree: This => finalize(tree, untpd.This(tree.qual)(curSource)) @@ -415,7 +413,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { val inlineCtx = inlineContext(call).fresh.setTyper(inlineTyper).setNewScope def inlinedFromOutside(tree: Tree)(span: Span): Tree = - Inlined(EmptyTree, Nil, tree)(ctx.withSource(inlinedMethod.topLevelClass.source)).withSpan(span) + Inlined(EmptyTree, tree)(ctx.withSource(inlinedMethod.topLevelClass.source)).withSpan(span) // A tree type map to prepare the inlined body for typechecked. // The translation maps references to `this` and parameters to @@ -520,9 +518,18 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { if (inlinedMethod == defn.Compiletime_error) issueError() - // Take care that only argument bindings go into `bindings`, since positions are - // different for bindings from arguments and bindings from body. - tpd.Inlined(call, finalBindings, finalExpansion) + // Widen TermRefs to bindings + val finalExpansion2 = finalExpansion.tpe match { + case tpe: TermRef if finalBindings.exists(x => x.symbol == tpe.symbol) => + // If the return type of an inline function is a singleton type of a parameter (like in `DottyPredef.the`) + // the expansion will be `{ val x = y; (x: x.type) }`. We ascribe the type to itself widening the + // local TermRef of the binding `{ val x = y; (x: y.type) }`. + tpd.Typed(finalExpansion, TypeTree(ctx.typer.avoidingType(finalExpansion, finalBindings))).withSpan(finalExpansion.span) + case _ => + finalExpansion + } + + tpd.Inlined(call, tpd.seq(finalBindings, finalExpansion2)) } } @@ -563,8 +570,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { val binding = tree.symbol.defTree for ((cls, reduced, prefix, precomputed) <- unapply(binding)) yield (cls, reduced, prefix, precomputed || binding.isInstanceOf[ValDef]) - case Inlined(_, bindings, expansion) => - unapplyLet(bindings, expansion) + case Inlined(_, expansion) => + unapply(expansion) case Block(stats, expr) if isPureExpr(tree) => unapplyLet(stats, expr) case _ => @@ -889,7 +896,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { case _ => false } - case Inlined(EmptyTree, Nil, ipat) => + case Inlined(EmptyTree, ipat) => reducePattern(bindingsBuf, fromBuf, toBuf, scrut, ipat) case _ => false } @@ -1162,7 +1169,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { val inlinedNormailizer = new TreeMap { override def transform(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = tree match { - case Inlined(EmptyTree, Nil, expr) if enclosingInlineds.isEmpty => transform(expr) + case Inlined(EmptyTree, expr) if enclosingInlineds.isEmpty => transform(expr) case _ => super.transform(tree) } } diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala index 5bd58b62a554..99142c0f3e48 100644 --- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -473,8 +473,8 @@ trait TypeAssigner { def assignType(tree: untpd.Block, stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = tree.withType(avoidingType(expr, stats)) - def assignType(tree: untpd.Inlined, bindings: List[Tree], expansion: Tree)(implicit ctx: Context): Inlined = - tree.withType(avoidingType(expansion, bindings)) + def assignType(tree: untpd.Inlined, expansion: Tree)(implicit ctx: Context): Inlined = + tree.withType(expansion.tpe) def assignType(tree: untpd.If, thenp: Tree, elsep: Tree)(implicit ctx: Context): If = tree.withType(thenp.tpe | elsep.tpe) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index b3bf15dfe745..5de9377895d5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1239,10 +1239,8 @@ class Typer extends Namer } def typedInlined(tree: untpd.Inlined, pt: Type)(implicit ctx: Context): Tree = { - val (exprCtx, bindings1) = typedBlockStats(tree.bindings) - val expansion1 = typed(tree.expansion, pt)(inlineContext(tree.call)(exprCtx)) - assignType(cpy.Inlined(tree)(tree.call, bindings1.asInstanceOf[List[MemberDef]], expansion1), - bindings1, expansion1) + val expansion1 = typed(tree.expansion, pt)(inlineContext(tree.call)) + assignType(cpy.Inlined(tree)(tree.call, expansion1), expansion1) } def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): Tree = track("typedTypeTree") { diff --git a/library/src/scala/tasty/reflect/Kernel.scala b/library/src/scala/tasty/reflect/Kernel.scala index e5ee0b24aee7..aa68a8ba5d8b 100644 --- a/library/src/scala/tasty/reflect/Kernel.scala +++ b/library/src/scala/tasty/reflect/Kernel.scala @@ -511,11 +511,10 @@ trait Kernel { def matchInlined(tree: Tree)(implicit ctx: Context): Option[Inlined] def Inlined_call(self: Inlined)(implicit ctx: Context): Option[Tree/* Term | TypeTree */] - def Inlined_bindings(self: Inlined)(implicit ctx: Context): List[Definition] def Inlined_body(self: Inlined)(implicit ctx: Context): Term - def Inlined_apply(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined - def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined + def Inlined_apply(call: Option[Tree/* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined + def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined /** Tree representing a selection of definition with a given name on a given prefix and number of nested scopes of inlined trees */ type SelectOuter <: Term diff --git a/library/src/scala/tasty/reflect/Printers.scala b/library/src/scala/tasty/reflect/Printers.scala index 9a7dbbe1f75d..baa78486b29c 100644 --- a/library/src/scala/tasty/reflect/Printers.scala +++ b/library/src/scala/tasty/reflect/Printers.scala @@ -187,10 +187,10 @@ trait Printers this += "Term.Try(" += block += ", " ++= handlers += ", " += finalizer += ")" case Term.Repeated(elems, elemtpt) => this += "Term.Repeated(" ++= elems += ", " += elemtpt += ")" - case Term.Inlined(call, bindings, expansion) => + case Term.Inlined(call, expansion) => this += "Term.Inlined(" visitOption(call, visitTree) - this += ", " ++= bindings += ", " += expansion += ")" + this += ", " += expansion += ")" case ValDef(name, tpt, rhs) => this += "ValDef(\"" += name += "\", " += tpt += ", " += rhs += ")" case DefDef(name, typeParams, paramss, returnTpt, rhs) => @@ -878,8 +878,8 @@ trait Printers } printFlatBlock(stats, expr) - case Term.Inlined(_, bindings, expansion) => - printFlatBlock(bindings, expansion) + case Term.Inlined(_, expansion) => + printTree(expansion) case Term.Lambda(meth, tpt) => // Printed in by it's DefDef @@ -949,10 +949,7 @@ trait Printers while (it.hasNext) extractFlatStats(it.next()) extractFlatStats(expr1) - case Term.Inlined(_, bindings, expansion) => - val it = bindings.iterator - while (it.hasNext) - extractFlatStats(it.next()) + case Term.Inlined(_, expansion) => extractFlatStats(expansion) case Term.Literal(Constant.Unit()) => // ignore case stat => flatStats += stat @@ -963,10 +960,7 @@ trait Printers while (it.hasNext) extractFlatStats(it.next()) extractFlatExpr(expr1) - case Term.Inlined(_, bindings, expansion) => - val it = bindings.iterator - while (it.hasNext) - extractFlatStats(it.next()) + case Term.Inlined(_, expansion) => extractFlatExpr(expansion) case term => term } @@ -1003,7 +997,6 @@ trait Printers // Avoid accidental application of opening `{` on next line with a double break def rec(next: Tree): Unit = next match { case Term.Block(stats, _) if stats.nonEmpty => this += doubleLineBreak() - case Term.Inlined(_, bindings, _) if bindings.nonEmpty => this += doubleLineBreak() case Term.Select(qual, _) => rec(qual) case Term.Apply(fn, _) => rec(fn) case Term.TypeApply(fn, _) => rec(fn) diff --git a/library/src/scala/tasty/reflect/TreeOps.scala b/library/src/scala/tasty/reflect/TreeOps.scala index cc9ce7e5e3ac..7e8ec32f0f0f 100644 --- a/library/src/scala/tasty/reflect/TreeOps.scala +++ b/library/src/scala/tasty/reflect/TreeOps.scala @@ -599,14 +599,14 @@ trait TreeOps extends Core { object Inlined { - def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = - kernel.Inlined_apply(call, bindings, expansion) + def apply(call: Option[Tree /* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined = + kernel.Inlined_apply(call, expansion) - def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = - kernel.Inlined_copy(original)(call, bindings, expansion) + def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], expansion: Term)(implicit ctx: Context): Inlined = + kernel.Inlined_copy(original)(call, expansion) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Option[Tree /* Term | TypeTree */], List[Definition], Term)] = - kernel.matchInlined(tree).map(x => (x.call, x.bindings, x.body)) + def unapply(tree: Tree)(implicit ctx: Context): Option[(Option[Tree /* Term | TypeTree */], Term)] = + kernel.matchInlined(tree).map(x => (x.call, x.body)) } @@ -743,7 +743,6 @@ trait TreeOps extends Core { implicit class InlinedAPI(self: Term.Inlined) { def call(implicit ctx: Context): Option[Tree /* Term | TypeTree */] = kernel.Inlined_call(self) - def bindings(implicit ctx: Context): List[Definition] = kernel.Inlined_bindings(self) def body(implicit ctx: Context): Term = kernel.Inlined_body(self) } diff --git a/library/src/scala/tasty/reflect/TreeUtils.scala b/library/src/scala/tasty/reflect/TreeUtils.scala index 4fec048ac8f0..9877b07ffad3 100644 --- a/library/src/scala/tasty/reflect/TreeUtils.scala +++ b/library/src/scala/tasty/reflect/TreeUtils.scala @@ -57,8 +57,8 @@ trait TreeUtils foldTrees(foldTrees(foldTree(x, block), handler), finalizer) case Term.Repeated(elems, elemtpt) => foldTrees(foldTree(x, elemtpt), elems) - case Term.Inlined(call, bindings, expansion) => - foldTree(foldTrees(x, bindings), expansion) + case Term.Inlined(call, expansion) => + foldTree(x, expansion) case IsDefinition(vdef @ ValDef(_, tpt, rhs)) => implicit val ctx = localCtx(vdef) foldTrees(foldTree(x, tpt), rhs) @@ -202,8 +202,8 @@ trait TreeUtils Term.Try.copy(tree)(transformTerm(block), transformCaseDefs(cases), finalizer.map(x => transformTerm(x))) case Term.Repeated(elems, elemtpt) => Term.Repeated.copy(tree)(transformTerms(elems), transformTypeTree(elemtpt)) - case Term.Inlined(call, bindings, expansion) => - Term.Inlined.copy(tree)(call, transformSubTrees(bindings), transformTerm(expansion)/*()call.symbol.localContext)*/) + case Term.Inlined(call, expansion) => + Term.Inlined.copy(tree)(call, transformTerm(expansion)/*(call.symbol.localContext)*/) } } diff --git a/library/src/scala/tasty/util/ConstantExtractor.scala b/library/src/scala/tasty/util/ConstantExtractor.scala index b4fb7294c090..f4c8e3a46f72 100644 --- a/library/src/scala/tasty/util/ConstantExtractor.scala +++ b/library/src/scala/tasty/util/ConstantExtractor.scala @@ -22,7 +22,7 @@ class ConstantExtractor[R <: Reflection with Singleton](val reflect: Reflection) def const(tree: Term): Option[T] = tree match { case Term.Literal(c) => Some(c.value.asInstanceOf[T]) case Term.Block(Nil, e) => const(e) - case Term.Inlined(_, Nil, e) => const(e) + case Term.Inlined(_, e) => const(e) case _ => None } const(expr.unseal) diff --git a/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala b/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala index 9535e3ef408c..334dd95145e7 100644 --- a/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala +++ b/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala @@ -993,7 +993,7 @@ class SemanticdbConsumer(sourceFilePath: java.nio.file.Path) extends TastyConsum super.traverseTree(tree) } - case Term.Inlined(Some(c), b, d) => { + case Term.Inlined(Some(c), d) => { /* In theory files should be compiled with -Yno-inline before running semanticdb. If this is not the case, here is a fallback to heuristically determine which predefFunction corresponds to an inlined term. diff --git a/tests/neg-with-compiler/i5941/macro_1.scala b/tests/neg-with-compiler/i5941/macro_1.scala index 4791335569a5..0c57fab8a3ff 100644 --- a/tests/neg-with-compiler/i5941/macro_1.scala +++ b/tests/neg-with-compiler/i5941/macro_1.scala @@ -24,7 +24,7 @@ object Lens { // exception: getter.unseal.underlyingArgument getter.unseal match { case Term.Inlined( - None, Nil, + None, Term.Block( DefDef(_, Nil, (param :: Nil) :: Nil, _, Some(Term.Select(o, field))) :: Nil, Term.Lambda(meth, _) diff --git a/tests/neg/tasty-macro-assert-1/quoted_1.scala b/tests/neg/tasty-macro-assert-1/quoted_1.scala index b52a238bd41b..4b7792f3d3e6 100644 --- a/tests/neg/tasty-macro-assert-1/quoted_1.scala +++ b/tests/neg/tasty-macro-assert-1/quoted_1.scala @@ -33,7 +33,7 @@ object Asserts { } tree match { - case Term.Inlined(_, Nil, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => + case Term.Inlined(_, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => '{assertTrue(${left.seal[Boolean]})} // Buggy code. To generate the errors case _ => '{assertTrue($cond)} diff --git a/tests/neg/tasty-macro-assert-2/quoted_1.scala b/tests/neg/tasty-macro-assert-2/quoted_1.scala index 34afc5800a0f..35157e4cfad0 100644 --- a/tests/neg/tasty-macro-assert-2/quoted_1.scala +++ b/tests/neg/tasty-macro-assert-2/quoted_1.scala @@ -33,7 +33,7 @@ object Asserts { } tree match { - case Term.Inlined(_, Nil, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => + case Term.Inlined(_, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => '{assertTrue(${left.seal[Boolean]})} // Buggy code. To generate the errors case _ => '{assertTrue($cond)} diff --git a/tests/pos-with-compiler/tasty/definitions.scala b/tests/pos-with-compiler/tasty/definitions.scala index b6e598892f4c..f57e718af3b3 100644 --- a/tests/pos-with-compiler/tasty/definitions.scala +++ b/tests/pos-with-compiler/tasty/definitions.scala @@ -78,7 +78,7 @@ object definitions { case Typed(expr: Term, tpt: TypeTree) case Assign(lhs: Term, rhs: Term) case Block(stats: List[Statement], expr: Term) - case Inlined(call: Option[Term], bindings: List[Definition], expr: Term) + case Inlined(call: Option[Term], expr: Term) case Lambda(method: Term, tpt: Option[TypeTree]) case If(cond: Term, thenPart: Term, elsePart: Term) case Match(scrutinee: Term, cases: List[CaseDef]) diff --git a/tests/pos/inlined-the.scala b/tests/pos/inlined-the.scala new file mode 100644 index 000000000000..688084e5f5be --- /dev/null +++ b/tests/pos/inlined-the.scala @@ -0,0 +1,41 @@ + +object Instances { + + class D[T] + + class C { + def f() = { + locally { + implied d[T] for D[T] + the[D[Int]] + implicit val s: 3 = ??? + val a: 3 = the[3] + val b: s.type = the[s.type] + () + } + + locally { + implied d[T] for D[T] + the2[D[Int]] + implicit val s: 3 = ??? + val a: 3 = the2[3] + val b: s.type = the2[s.type] + () + } + + locally { + implicit val s: List[3] = ??? + val a: List[3] = the2[List[3]] + + implicit val sl: List[s.type] = ??? + val b: List[s.type] = the2[List[s.type]] + () + } + } + } + + inline def the2[T](implicit x: T): x.type = x + + inline def theList[T](implicit x: T): List[x.type] = List[x.type](x) + +} diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala index 1c03f7351e2c..d843b344cee7 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala @@ -14,7 +14,7 @@ object Foo { case IsBindSymbol(sym) => sym.tree.show.toExpr } x.unseal match { - case Term.Inlined(None, Nil, arg) => definitionString(arg) + case Term.Inlined(None, arg) => definitionString(arg) case arg => definitionString(arg) // TODO should all by name parameters be in an inline node? } } diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala index c667717d07a2..8e2f3890efe4 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala @@ -14,7 +14,7 @@ object Foo { case IsBindSymbol(sym) => sym.tree.show.toExpr } x.unseal match { - case Term.Inlined(None, Nil, arg) => definitionString(arg) + case Term.Inlined(None, arg) => definitionString(arg) case arg => definitionString(arg) // TODO should all by name parameters be in an inline node? } } diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala index 2bb11a418d83..4ff5fec787db 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala @@ -18,7 +18,7 @@ object Foo { } x.unseal match { - case Term.Inlined(None, Nil, arg) => definitionString(arg) + case Term.Inlined(None, arg) => definitionString(arg) case arg => definitionString(arg) // TODO should all by name parameters be in an inline node } } diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala index 1047d81a75ef..bae9dccd591b 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala @@ -18,7 +18,7 @@ object Foo { } x.unseal match { - case Term.Inlined(None, Nil, arg) => definitionString(arg) + case Term.Inlined(None, arg) => definitionString(arg) case arg => definitionString(arg) // TODO should all by name parameters be in an inline node } } diff --git a/tests/run-with-compiler/i5941/macro_1.scala b/tests/run-with-compiler/i5941/macro_1.scala index 6eed35a2a69c..5a19f6c7625e 100644 --- a/tests/run-with-compiler/i5941/macro_1.scala +++ b/tests/run-with-compiler/i5941/macro_1.scala @@ -44,7 +44,7 @@ object Lens { object Function { def unapply(t: Term): Option[(List[ValDef], Term)] = t match { case Term.Inlined( - None, Nil, + None, Term.Block( (ddef @ DefDef(_, Nil, params :: Nil, _, Some(body))) :: Nil, Term.Lambda(meth, _) diff --git a/tests/run/tasty-argument-tree-1.check b/tests/run/tasty-argument-tree-1.check index 8d50036bcadc..0e169e85912e 100644 --- a/tests/run/tasty-argument-tree-1.check +++ b/tests/run/tasty-argument-tree-1.check @@ -1,33 +1,33 @@ -tree: Term.Inlined(None, Nil, Term.Literal(Constant.Int(3))) +tree: Term.Inlined(None, Term.Literal(Constant.Int(3))) tree deref. vals: Term.Literal(Constant.Int(3)) -tree: Term.Inlined(None, Nil, Term.Ident("v")) +tree: Term.Inlined(None, Term.Ident("v")) tree deref. vals: Term.Literal(Constant.Int(1)) -tree: Term.Inlined(None, Nil, Term.Ident("x")) +tree: Term.Inlined(None, Term.Ident("x")) tree deref. vals: Term.Literal(Constant.Int(2)) -tree: Term.Inlined(None, Nil, Term.Ident("l")) +tree: Term.Inlined(None, Term.Ident("l")) tree deref. vals: Term.Literal(Constant.Int(3)) -tree: Term.Inlined(None, Nil, Term.Ident("a")) +tree: Term.Inlined(None, Term.Ident("a")) tree deref. vals: Term.Ident("a") -tree: Term.Inlined(None, Nil, Term.Ident("x")) +tree: Term.Inlined(None, Term.Ident("x")) tree deref. vals: Term.Ident("b") -tree: Term.Inlined(None, Nil, Term.Ident("vv")) +tree: Term.Inlined(None, Term.Ident("vv")) tree deref. vals: Term.Literal(Constant.Int(1)) -tree: Term.Inlined(None, Nil, Term.Ident("x")) +tree: Term.Inlined(None, Term.Ident("x")) tree deref. vals: Term.Literal(Constant.Int(1)) -tree: Term.Inlined(None, Nil, Term.Ident("vd")) +tree: Term.Inlined(None, Term.Ident("vd")) tree deref. vals: Term.Literal(Constant.Int(2)) -tree: Term.Inlined(None, Nil, Term.Ident("x")) +tree: Term.Inlined(None, Term.Ident("x")) tree deref. vals: Term.Literal(Constant.Int(2)) -tree: Term.Inlined(None, Nil, Term.Ident("x")) +tree: Term.Inlined(None, Term.Ident("x")) tree deref. vals: Term.Apply(Term.TypeApply(Term.Select(Term.Ident("Tuple2"), "apply"), List(TypeTree.Inferred(), TypeTree.Inferred())), List(Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2)))) diff --git a/tests/run/tasty-extractors-1.check b/tests/run/tasty-extractors-1.check index 36ddc8f2f20e..14f87349ba6f 100644 --- a/tests/run/tasty-extractors-1.check +++ b/tests/run/tasty-extractors-1.check @@ -1,120 +1,120 @@ -Term.Inlined(None, Nil, Term.Literal(Constant.Boolean(true))) +Term.Inlined(None, Term.Literal(Constant.Boolean(true))) Type.ConstantType(Constant.Boolean(true)) -Term.Inlined(None, Nil, Term.Literal(Constant.Int(1))) +Term.Inlined(None, Term.Literal(Constant.Int(1))) Type.ConstantType(Constant.Int(1)) -Term.Inlined(None, Nil, Term.Literal(Constant.Long(2))) +Term.Inlined(None, Term.Literal(Constant.Long(2))) Type.ConstantType(Constant.Long(2)) -Term.Inlined(None, Nil, Term.Literal(Constant.Float(2.1))) +Term.Inlined(None, Term.Literal(Constant.Float(2.1))) Type.ConstantType(Constant.Float(2.1)) -Term.Inlined(None, Nil, Term.Literal(Constant.Double(2.2))) +Term.Inlined(None, Term.Literal(Constant.Double(2.2))) Type.ConstantType(Constant.Double(2.2)) -Term.Inlined(None, Nil, Term.Literal(Constant.String("abc"))) +Term.Inlined(None, Term.Literal(Constant.String("abc"))) Type.ConstantType(Constant.String("abc")) -Term.Inlined(None, Nil, Term.Apply(Term.Ident("println"), List(Term.Literal(Constant.String("abc"))))) +Term.Inlined(None, Term.Apply(Term.Ident("println"), List(Term.Literal(Constant.String("abc"))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Typed(Term.Literal(Constant.Int(8)), TypeTree.Ident("Int"))) +Term.Inlined(None, Term.Typed(Term.Literal(Constant.Int(8)), TypeTree.Ident("Int"))) Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Typed(Term.Literal(Constant.Byte(8)), TypeTree.Ident("Byte"))) +Term.Inlined(None, Term.Typed(Term.Literal(Constant.Byte(8)), TypeTree.Ident("Byte"))) Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Typed(Term.Literal(Constant.Short(8)), TypeTree.Ident("Short"))) +Term.Inlined(None, Term.Typed(Term.Literal(Constant.Short(8)), TypeTree.Ident("Short"))) Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Literal(Constant.Char(a))) +Term.Inlined(None, Term.Literal(Constant.Char(a))) Type.ConstantType(Constant.Char(a)) -Term.Inlined(None, Nil, Term.Block(List(Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2))), Term.Literal(Constant.Int(3)))) +Term.Inlined(None, Term.Block(List(Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2))), Term.Literal(Constant.Int(3)))) Type.ConstantType(Constant.Int(3)) -Term.Inlined(None, Nil, Term.If(Term.Typed(Term.Literal(Constant.Boolean(true)), TypeTree.Ident("Boolean")), Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2)))) +Term.Inlined(None, Term.If(Term.Typed(Term.Literal(Constant.Boolean(true)), TypeTree.Ident("Boolean")), Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2)))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("a")), List(CaseDef(Pattern.Value(Term.Literal(Constant.String("a"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("a")), List(CaseDef(Pattern.Value(Term.Literal(Constant.String("a"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("b")), List(CaseDef(Pattern.Bind("n", Pattern.Value(Term.Ident("_"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("b")), List(CaseDef(Pattern.Bind("n", Pattern.Value(Term.Ident("_"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("c")), List(CaseDef(Pattern.Bind("n", Pattern.TypeTest(TypeTree.Ident("String"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("c")), List(CaseDef(Pattern.Bind("n", Pattern.TypeTest(TypeTree.Ident("String"))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("e")), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("e")), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("f")), List(CaseDef(Pattern.TypeTest(TypeTree.Ident("String")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("f")), List(CaseDef(Pattern.TypeTest(TypeTree.Ident("String")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Typed(Term.Literal(Constant.String("g")), TypeTree.Ident("Any")), List(CaseDef(Pattern.Alternative(List(Pattern.TypeTest(TypeTree.Ident("String")), Pattern.TypeTest(TypeTree.Ident("Int")))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Typed(Term.Literal(Constant.String("g")), TypeTree.Ident("Any")), List(CaseDef(Pattern.Alternative(List(Pattern.TypeTest(TypeTree.Ident("String")), Pattern.TypeTest(TypeTree.Ident("Int")))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Literal(Constant.String("h")), List(CaseDef(Pattern.Value(Term.Ident("_")), Some(Term.Literal(Constant.Boolean(false))), Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Literal(Constant.String("h")), List(CaseDef(Pattern.Value(Term.Ident("_")), Some(Term.Literal(Constant.Boolean(false))), Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.String("o"))))), Term.Match(Term.Literal(Constant.String("i")), List(CaseDef(Pattern.Bind("a", Pattern.Value(Term.Ident("_"))), None, Term.Block(Nil, Term.Literal(Constant.Unit()))))))) +Term.Inlined(None, Term.Block(List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.String("o"))))), Term.Match(Term.Literal(Constant.String("i")), List(CaseDef(Pattern.Bind("a", Pattern.Value(Term.Ident("_"))), None, Term.Block(Nil, Term.Literal(Constant.Unit()))))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Match(Term.Ident("Nil"), List(CaseDef(Pattern.Unapply(Term.TypeApply(Term.Select(Term.Ident("List"), "unapplySeq"), List(TypeTree.Inferred())), Nil, List(Pattern.Bind("a", Pattern.Value(Term.Ident("_"))), Pattern.Bind("b", Pattern.Value(Term.Ident("_"))), Pattern.Bind("c", Pattern.Value(Term.Ident("_"))))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) +Term.Inlined(None, Term.Match(Term.Ident("Nil"), List(CaseDef(Pattern.Unapply(Term.TypeApply(Term.Select(Term.Ident("List"), "unapplySeq"), List(TypeTree.Inferred())), Nil, List(Pattern.Bind("a", Pattern.Value(Term.Ident("_"))), Pattern.Bind("b", Pattern.Value(Term.Ident("_"))), Pattern.Bind("c", Pattern.Value(Term.Ident("_"))))), None, Term.Block(Nil, Term.Literal(Constant.Unit())))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Try(Term.Literal(Constant.Int(1)), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))), None)) +Term.Inlined(None, Term.Try(Term.Literal(Constant.Int(1)), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))), None)) Type.OrType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))), Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix())))) -Term.Inlined(None, Nil, Term.Try(Term.Literal(Constant.Int(2)), Nil, Some(Term.Literal(Constant.Unit())))) +Term.Inlined(None, Term.Try(Term.Literal(Constant.Int(2)), Nil, Some(Term.Literal(Constant.Unit())))) Type.ConstantType(Constant.Int(2)) -Term.Inlined(None, Nil, Term.Try(Term.Literal(Constant.Int(3)), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))), Some(Term.Literal(Constant.Unit())))) +Term.Inlined(None, Term.Try(Term.Literal(Constant.Int(3)), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Block(Nil, Term.Literal(Constant.Unit())))), Some(Term.Literal(Constant.Unit())))) Type.OrType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))), Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix())))) -Term.Inlined(None, Nil, Term.Apply(Term.Select(Term.Literal(Constant.String("a")), "=="), List(Term.Literal(Constant.String("b"))))) +Term.Inlined(None, Term.Apply(Term.Select(Term.Literal(Constant.String("a")), "=="), List(Term.Literal(Constant.String("b"))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Apply(Term.Select(Term.New(TypeTree.Ident("Object")), ""), Nil)) +Term.Inlined(None, Term.Apply(Term.Select(Term.New(TypeTree.Ident("Object")), ""), Nil)) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Apply(Term.Select(Term.Ident("Int"), "box"), List(Term.NamedArg("x", Term.Literal(Constant.Int(9)))))) +Term.Inlined(None, Term.Apply(Term.Select(Term.Ident("Int"), "box"), List(Term.NamedArg("x", Term.Literal(Constant.Int(9)))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Apply(Term.TypeApply(Term.Select(Term.Ident("Ordering"), "apply"), List(TypeTree.Ident("Int"))), List(Term.Ident("Int")))) +Term.Inlined(None, Term.Apply(Term.TypeApply(Term.Select(Term.Ident("Ordering"), "apply"), List(TypeTree.Ident("Int"))), List(Term.Ident("Int")))) Type.AppliedType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))), List(Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))))) -Term.Inlined(None, Nil, Term.Block(List(ValDef("a", TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ValDef("a", TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ValDef("b", TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ValDef("b", TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f1", Nil, Nil, TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f1", Nil, Nil, TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(3))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f2", Nil, Nil, TypeTree.Ident("Int"), Some(Term.Return(Term.Literal(Constant.Int(4)))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f2", Nil, Nil, TypeTree.Ident("Int"), Some(Term.Return(Term.Literal(Constant.Int(4)))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f3", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Ident("i")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f3", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Ident("i")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f4", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None)), List(ValDef("j", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Apply(Term.Select(Term.Ident("i"), "+"), List(Term.Ident("j")))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f4", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None)), List(ValDef("j", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Apply(Term.Select(Term.Ident("i"), "+"), List(Term.Ident("j")))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f5", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Ident("i"))), DefDef("f5$default$1", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(9))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f5", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Ident("Int"), Some(Term.Ident("i"))), DefDef("f5$default$1", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(9))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f6", List(TypeDef("T", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), List(List(ValDef("x", TypeTree.Ident("T"), None))), TypeTree.Ident("T"), Some(Term.Ident("x")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f6", List(TypeDef("T", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), List(List(ValDef("x", TypeTree.Ident("T"), None))), TypeTree.Ident("T"), Some(Term.Ident("x")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f7", List(TypeDef("T", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), List(List(ValDef("x", TypeTree.Ident("T"), None))), TypeTree.Singleton(Term.Ident("x")), Some(Term.Ident("x")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f7", List(TypeDef("T", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), List(List(ValDef("x", TypeTree.Ident("T"), None))), TypeTree.Singleton(Term.Ident("x")), Some(Term.Ident("x")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f8", Nil, List(List(ValDef("i", TypeTree.Annotated(TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Ident("Int"))), Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), None))), TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(9))))), Term.Apply(Term.Ident("f8"), List(Term.Typed(Term.Repeated(List(Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2)), Term.Literal(Constant.Int(3))), TypeTree.Inferred()), TypeTree.Inferred()))))) +Term.Inlined(None, Term.Block(List(DefDef("f8", Nil, List(List(ValDef("i", TypeTree.Annotated(TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Ident("Int"))), Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), None))), TypeTree.Ident("Int"), Some(Term.Literal(Constant.Int(9))))), Term.Apply(Term.Ident("f8"), List(Term.Typed(Term.Repeated(List(Term.Literal(Constant.Int(1)), Term.Literal(Constant.Int(2)), Term.Literal(Constant.Int(3))), TypeTree.Inferred()), TypeTree.Inferred()))))) Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("f9", Nil, List(List(ValDef("i", TypeTree.ByName(TypeTree.Ident("Int")), None))), TypeTree.Ident("Int"), Some(Term.Ident("i")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(DefDef("f9", Nil, List(List(ValDef("i", TypeTree.ByName(TypeTree.Ident("Int")), None))), TypeTree.Ident("Int"), Some(Term.Ident("i")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) diff --git a/tests/run/tasty-extractors-2.check b/tests/run/tasty-extractors-2.check index 7dcbd9fbae84..90d838d933c7 100644 --- a/tests/run/tasty-extractors-2.check +++ b/tests/run/tasty-extractors-2.check @@ -1,105 +1,105 @@ -Term.Inlined(None, Nil, Term.Block(List(ValDef("x", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(1))))), Term.Assign(Term.Ident("x"), Term.Literal(Constant.Int(2))))) +Term.Inlined(None, Term.Block(List(ValDef("x", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(1))))), Term.Assign(Term.Ident("x"), Term.Literal(Constant.Int(2))))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), Some(Term.Ident("x")))), Term.Lambda(Term.Ident("$anonfun"), None))) +Term.Inlined(None, Term.Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), Some(Term.Ident("x")))), Term.Lambda(Term.Ident("$anonfun"), None))) Type.AppliedType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))), List(Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))), Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))))) -Term.Inlined(None, Nil, Term.Ident("???")) +Term.Inlined(None, Term.Ident("???")) Type.SymRef(IsDefDefSymbol(), Type.SymRef(IsValDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix())))) -Term.Inlined(None, Nil, Term.Literal(Constant.Int(1))) +Term.Inlined(None, Term.Literal(Constant.Int(1))) Type.ConstantType(Constant.Int(1)) -Term.Inlined(None, Nil, Term.Typed(Term.Literal(Constant.Int(1)), TypeTree.Ident("Int"))) +Term.Inlined(None, Term.Typed(Term.Literal(Constant.Int(1)), TypeTree.Ident("Int"))) Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Typed(Term.Ident("Nil"), TypeTree.Applied(TypeTree.Ident("List"), List(TypeTree.Ident("Int"))))) +Term.Inlined(None, Term.Typed(Term.Ident("Nil"), TypeTree.Applied(TypeTree.Ident("List"), List(TypeTree.Ident("Int"))))) Type.AppliedType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))), List(Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))))) -Term.Inlined(None, Nil, Term.Typed(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Baz")), ""), Nil), TypeTree.Applied(TypeTree.Ident("&"), List(TypeTree.Ident("Foo"), TypeTree.Ident("Bar"))))) +Term.Inlined(None, Term.Typed(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Baz")), ""), Nil), TypeTree.Applied(TypeTree.Ident("&"), List(TypeTree.Ident("Foo"), TypeTree.Ident("Bar"))))) Type.AndType(Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix()))), Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))) -Term.Inlined(None, Nil, Term.Typed(Term.Literal(Constant.Int(1)), TypeTree.Applied(TypeTree.Ident("|"), List(TypeTree.Ident("Int"), TypeTree.Ident("String"))))) +Term.Inlined(None, Term.Typed(Term.Literal(Constant.Int(1)), TypeTree.Applied(TypeTree.Ident("|"), List(TypeTree.Ident("Int"), TypeTree.Ident("String"))))) Type.OrType(Type.SymRef(IsClassDefSymbol(), Type.SymRef(IsPackageDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<>), NoPrefix())))), Type.SymRef(IsTypeDefSymbol(), Type.SymRef(IsValDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, Nil)), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, Nil)), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ValDef("Foo", TypeTree.Ident("Foo$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo$")), ""), Nil))), ClassDef("Foo$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo")), None)), Nil)), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ValDef("Foo", TypeTree.Ident("Foo$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo$")), ""), Nil))), ClassDef("Foo$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo")), None)), Nil)), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(TypeDef("Foo", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(TypeDef("Foo", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred()))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(TypeDef("Foo", TypeTree.Ident("Int"))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(TypeDef("Foo", TypeTree.Ident("Int"))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(TypeDef("Foo", TypeBoundsTree(TypeTree.Ident("Null"), TypeTree.Ident("Object")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(TypeDef("Foo", TypeBoundsTree(TypeTree.Ident("Null"), TypeTree.Ident("Object")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0)))), DefDef("a_=", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Unit())))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0)))), DefDef("a_=", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Unit())))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(DefDef("a", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Product"), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, None, List(DefDef("productElementName", Nil, List(List(ValDef("x$1", TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Int"), None))), TypeTree.Select(Term.Select(Term.Ident("java"), "lang"), "String"), Some(Term.Match(Term.Ident("x$1"), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Apply(Term.Ident("throw"), List(Term.Apply(Term.Select(Term.New(TypeTree.Select(Term.Select(Term.Ident("java"), "lang"), "IndexOutOfBoundsException")), ""), List(Term.Apply(Term.Select(Term.Select(Term.Select(Term.Ident("java"), "lang"), "String"), "valueOf"), List(Term.Ident("x$1")))))))))))), DefDef("copy", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil))))), ValDef("Foo", TypeTree.Ident("Foo$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo$")), ""), Nil))), ClassDef("Foo$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Inferred())), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo")), None)), List(DefDef("apply", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil))), DefDef("unapply", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Boolean(true))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Product"), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, None, List(DefDef("productElementName", Nil, List(List(ValDef("x$1", TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Int"), None))), TypeTree.Select(Term.Select(Term.Ident("java"), "lang"), "String"), Some(Term.Match(Term.Ident("x$1"), List(CaseDef(Pattern.Value(Term.Ident("_")), None, Term.Apply(Term.Ident("throw"), List(Term.Apply(Term.Select(Term.New(TypeTree.Select(Term.Select(Term.Ident("java"), "lang"), "IndexOutOfBoundsException")), ""), List(Term.Apply(Term.Select(Term.Select(Term.Select(Term.Ident("java"), "lang"), "String"), "valueOf"), List(Term.Ident("x$1")))))))))))), DefDef("copy", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil))))), ValDef("Foo", TypeTree.Ident("Foo$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo$")), ""), Nil))), ClassDef("Foo$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Inferred())), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo")), None)), List(DefDef("apply", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil))), DefDef("unapply", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Boolean(true))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo1", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo1", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo2", DefDef("", Nil, List(List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo2", DefDef("", Nil, List(List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo3", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None))), ValDef("Foo3", TypeTree.Ident("Foo3$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo3$")), ""), Nil))), ClassDef("Foo3$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo3")), None)), List(DefDef("$lessinit$greater$default$1", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(5))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo3", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None))), ValDef("Foo3", TypeTree.Ident("Foo3$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo3$")), ""), Nil))), ClassDef("Foo3$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo3")), None)), List(DefDef("$lessinit$greater$default$1", Nil, Nil, TypeTree.Inferred(), Some(Term.Literal(Constant.Int(5))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo4", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo4", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo5", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None))), ValDef("Foo5", TypeTree.Ident("Foo5$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo5$")), ""), Nil))), ClassDef("Foo5$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo5")), None)), List(DefDef("$lessinit$greater$default$2", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), Some(Term.Ident("a")))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo5", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None))), ValDef("Foo5", TypeTree.Ident("Foo5$"), Some(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo5$")), ""), Nil))), ClassDef("Foo5$", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")), Nil, Some(ValDef("_", TypeTree.Singleton(Term.Ident("Foo5")), None)), List(DefDef("$lessinit$greater$default$2", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), Some(Term.Ident("a")))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo6", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Singleton(Term.Ident("a")), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo6", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None)), List(ValDef("b", TypeTree.Singleton(Term.Ident("a")), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), ValDef("b", TypeTree.Inferred(), None)))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo7", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), DefDef("", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Block(List(Term.Apply(Term.Select(Term.This(Some(Id("Foo7"))), ""), List(Term.Literal(Constant.Int(6))))), Term.Literal(Constant.Unit()))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo7", DefDef("", Nil, List(List(ValDef("a", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), None), DefDef("", Nil, List(Nil), TypeTree.Inferred(), Some(Term.Block(List(Term.Apply(Term.Select(Term.This(Some(Id("Foo7"))), ""), List(Term.Literal(Constant.Int(6))))), Term.Literal(Constant.Unit()))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo8", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(Term.Apply(Term.Ident("println"), List(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo8", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(Term.Apply(Term.Ident("println"), List(Term.Literal(Constant.Int(0))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo10", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(9))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo10", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(9))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo11", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(10)))), DefDef("a_=", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Unit())))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo11", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(10)))), DefDef("a_=", Nil, List(List(ValDef("x$1", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Literal(Constant.Unit())))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo12", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(11))))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo12", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("a", TypeTree.Inferred(), Some(Term.Literal(Constant.Int(11))))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, Nil), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo")), ""), Nil)), Nil, None, Nil)), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, Nil), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo")), ""), Nil)), Nil, None, Nil)), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo2", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(TypeTree.Inferred()), Nil, None, Nil), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Ident("Foo2")), Nil, None, Nil)), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo2", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(TypeTree.Inferred()), Nil, None, Nil), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil), TypeTree.Ident("Foo2")), Nil, None, Nil)), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("i", TypeTree.Inferred(), None))), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo")), ""), List(Term.Literal(Constant.Int(1))))), Nil, None, Nil)), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(List(ValDef("i", TypeTree.Ident("Int"), None))), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(ValDef("i", TypeTree.Inferred(), None))), ClassDef("Bar", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Ident("Foo")), ""), List(Term.Literal(Constant.Int(1))))), Nil, None, Nil)), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(TypeDef("X", TypeTree.Ident("Int")))), DefDef("f", Nil, List(List(ValDef("a", TypeTree.Ident("Foo"), None))), TypeTree.Select(Term.Ident("a"), "X"), Some(Term.Ident("???")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(TypeDef("X", TypeTree.Ident("Int")))), DefDef("f", Nil, List(List(ValDef("a", TypeTree.Ident("Foo"), None))), TypeTree.Select(Term.Ident("a"), "X"), Some(Term.Ident("???")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(TypeDef("X", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred())))), DefDef("f", Nil, List(List(ValDef("a", TypeTree.Refined(TypeTree.Ident("Foo"), List(TypeDef("X", TypeTree.Ident("Int")))), None))), TypeTree.Select(Term.Ident("a"), "X"), Some(Term.Ident("???")))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ClassDef("Foo", DefDef("", Nil, List(Nil), TypeTree.Inferred(), None), List(Term.Apply(Term.Select(Term.New(TypeTree.Inferred()), ""), Nil)), Nil, None, List(TypeDef("X", TypeBoundsTree(TypeTree.Inferred(), TypeTree.Inferred())))), DefDef("f", Nil, List(List(ValDef("a", TypeTree.Refined(TypeTree.Ident("Foo"), List(TypeDef("X", TypeTree.Ident("Int")))), None))), TypeTree.Select(Term.Ident("a"), "X"), Some(Term.Ident("???")))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) -Term.Inlined(None, Nil, Term.Block(List(ValDef("lambda", TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Ident("Int"), TypeTree.Ident("Int"))), Some(Term.Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Ident("x")))), Term.Lambda(Term.Ident("$anonfun"), None))))), Term.Literal(Constant.Unit()))) +Term.Inlined(None, Term.Block(List(ValDef("lambda", TypeTree.Applied(TypeTree.Inferred(), List(TypeTree.Ident("Int"), TypeTree.Ident("Int"))), Some(Term.Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeTree.Inferred(), None))), TypeTree.Inferred(), Some(Term.Ident("x")))), Term.Lambda(Term.Ident("$anonfun"), None))))), Term.Literal(Constant.Unit()))) Type.SymRef(IsClassDefSymbol(), Type.ThisType(Type.SymRef(IsPackageDefSymbol(), NoPrefix()))) diff --git a/tests/run/tasty-macro-assert/quoted_1.scala b/tests/run/tasty-macro-assert/quoted_1.scala index 0e97464c5d12..159606cda886 100644 --- a/tests/run/tasty-macro-assert/quoted_1.scala +++ b/tests/run/tasty-macro-assert/quoted_1.scala @@ -33,7 +33,7 @@ object Asserts { } tree match { - case Term.Inlined(_, Nil, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => + case Term.Inlined(_, Term.Apply(Term.Select(OpsTree(left), op), right :: Nil)) => op match { case "===" => '{assertEquals(${left.seal[Any]}, ${right.seal[Any]})} case "!==" => '{assertNotEquals(${left.seal[Any]}, ${right.seal[Any]})} diff --git a/tests/run/tasty-macro-const/quoted_1.scala b/tests/run/tasty-macro-const/quoted_1.scala index 20f419545bf0..0bdbfde4e24b 100644 --- a/tests/run/tasty-macro-const/quoted_1.scala +++ b/tests/run/tasty-macro-const/quoted_1.scala @@ -9,7 +9,7 @@ object Macros { import reflection._ val xTree: Term = x.unseal xTree match { - case Term.Inlined(_, _, Term.Literal(Constant.Int(n))) => + case Term.Inlined(_, Term.Literal(Constant.Int(n))) => if (n <= 0) throw new QuoteError("Parameter must be natural number") xTree.seal[Int]