diff --git a/src/main/scala/inox/Program.scala b/src/main/scala/inox/Program.scala index 69ce5b2e504a8e513f89543c143deae414739ef1..0b28fca03d2087efa8f9bcda8d93062b006cf7b3 100644 --- a/src/main/scala/inox/Program.scala +++ b/src/main/scala/inox/Program.scala @@ -16,7 +16,7 @@ import ast._ * * ''printerOpts'' provides options for tree printers. */ -trait Program { +trait Program { self => val trees: Trees implicit val symbols: trees.Symbols implicit val ctx: Context @@ -24,27 +24,27 @@ trait Program { implicit def implicitProgram: this.type = this implicit def printerOpts: trees.PrinterOptions = trees.PrinterOptions.fromSymbols(symbols, ctx) - def transform(t: trees.SelfTransformer): Program { val trees: Program.this.trees.type } = new Program { - val trees: Program.this.trees.type = Program.this.trees - val symbols = Program.this.symbols.transform(t) - val ctx = Program.this.ctx + def transform(t: TreeTransformer { val s: self.trees.type }): Program { val trees: t.t.type } = new Program { + val trees: t.t.type = t.t + val symbols = self.symbols.transform(t) + val ctx = self.ctx } - def transform(t: SymbolTransformer { val s: trees.type }): Program { val trees: t.t.type } = new Program { + def transform(t: SymbolTransformer { val s: self.trees.type }): Program { val trees: t.t.type } = new Program { val trees: t.t.type = t.t - val symbols = t.transform(Program.this.symbols) - val ctx = Program.this.ctx + val symbols = t.transform(self.symbols) + val ctx = self.ctx } - def withFunctions(functions: Seq[trees.FunDef]): Program { val trees: Program.this.trees.type } = new Program { - val trees: Program.this.trees.type = Program.this.trees - val symbols = Program.this.symbols.withFunctions(functions) - val ctx = Program.this.ctx + def withFunctions(functions: Seq[trees.FunDef]): Program { val trees: self.trees.type } = new Program { + val trees: self.trees.type = self.trees + val symbols = self.symbols.withFunctions(functions) + val ctx = self.ctx } - def withADTs(adts: Seq[trees.ADTDefinition]): Program { val trees: Program.this.trees.type } = new Program { - val trees: Program.this.trees.type = Program.this.trees - val symbols = Program.this.symbols.withADTs(adts) - val ctx = Program.this.ctx + def withADTs(adts: Seq[trees.ADTDefinition]): Program { val trees: self.trees.type } = new Program { + val trees: self.trees.type = self.trees + val symbols = self.symbols.withADTs(adts) + val ctx = self.ctx } } diff --git a/src/main/scala/inox/ast/Definitions.scala b/src/main/scala/inox/ast/Definitions.scala index 86ef28e9d6686f29ecf194d93e70d9d908482270..7bdbe1895e7eb266b64af212f0b3355f91ef1f01 100644 --- a/src/main/scala/inox/ast/Definitions.scala +++ b/src/main/scala/inox/ast/Definitions.scala @@ -136,7 +136,7 @@ trait Definitions { self: Trees => functions.map(p => prettyPrint(p._2, opts)).mkString("\n\n") } - def transform(trans: SelfTransformer): Symbols = SymbolTransformer(trans).transform(this) + def transform(t: TreeTransformer { val s: self.type }): t.t.Symbols = SymbolTransformer(t).transform(this) override def equals(that: Any): Boolean = that match { case sym: AbstractSymbols => functions == sym.functions && adts == sym.adts