forked from scala/scala
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-5943 toolboxes now autoimport Predef and scala
Previously tb.typeCheck used default typer, which builds upon NoContext. Changing the context to analyzer.rootContext(NoCompilationUnit, EmptyTree) fixed the missing imports problem. Unfortunately this doesn't help in cases like "math.sqrt(4.0)" because of https://issues.scala-lang.org/browse/SI-6393. But anyways I'm adding this test case to pending.
- Loading branch information
Showing
8 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scala.this.Predef.intWrapper(1).to(3).map[Int, scala.collection.immutable.IndexedSeq[Int]](((x$1: Int) => x$1.+(1)))(immutable.this.IndexedSeq.canBuildFrom[Int]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.runtime.{currentMirror => cm} | ||
import scala.tools.reflect.ToolBox | ||
|
||
object Test extends App { | ||
val tb = cm.mkToolBox() | ||
val expr = tb.parse("1 to 3 map (_+1)") | ||
println(tb.typeCheck(expr)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Vector(2, 3, 4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.runtime.{currentMirror => cm} | ||
import scala.tools.reflect.ToolBox | ||
|
||
object Test extends App { | ||
val tb = cm.mkToolBox() | ||
val expr = tb.parse("1 to 3 map (_+1)") | ||
println(tb.eval(expr)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.runtime.{currentMirror => cm} | ||
import scala.tools.reflect.ToolBox | ||
|
||
// pending until https://issues.scala-lang.org/browse/SI-6393 is fixed | ||
object Test extends App { | ||
val tb = cm.mkToolBox() | ||
val expr = tb.parse("math.sqrt(4.0)") | ||
println(tb.typeCheck(expr)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.runtime.{currentMirror => cm} | ||
import scala.tools.reflect.ToolBox | ||
|
||
// pending until https://issues.scala-lang.org/browse/SI-6393 is fixed | ||
object Test extends App { | ||
val tb = cm.mkToolBox() | ||
val expr = tb.parse("math.sqrt(4.0)") | ||
println(tb.eval(expr)) | ||
} |