Although the exact answer to this question can only be asked by the authors of the compiler, we can guess that this is not possible by looking at the source code of the continuation plugin.
If you look at the source of the continuations, you can see this:
val anfPhase = new SelectiveANFTransform() { val global = SelectiveCPSPlugin.this.global val runsAfter = List("pickler") } val cpsPhase = new SelectiveCPSTransform() { val global = SelectiveCPSPlugin.this.global val runsAfter = List("selectiveanf") }
The anfPhase phase is executed after the pickler phase and cpsPhase after selectiveAnf. If you look at SelectiveANFTransform.scala
abstract class SelectiveANFTransform extends PluginComponent with Transform with TypingTransformers with CPSUtils {
If we use phases of scalac -Xshow, we can see the phases during the compilation process:
parser namer packageobjects typer superaccessors pickler refchecks selectiveanf liftcode selectivecps uncurry ......
As you can see, the typer phase is applied before the selectiveAnf and selectiveCps stages. It should be confirmed that type inference occurs in the typer phase, but if that is true and would be reasonable, it should now be clear why you cannot omit the Int type to 7.tracked and 35.tracked.
Now, if you are not satisfied yet, you should know that the compiler works by performing a set of transformations on the "trees", which you can see using the following parameters:
- -Xprint: shows your scala code after a certain phase
- -Xprint: -Show-trees show your scala code and trees after the phase is complete.
- -YBrowse: opens a graphical interface for viewing both.
Edmondo1984
source share