File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed
sbt-dotty/sbt-test/sbt-dotty/quoted-example-project Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 11scalaVersion := sys.props(" plugin.scalaVersion" )
22
33libraryDependencies ++= Seq (
4- " ch.epfl.lamp" % " dotty_0.14 " % scalaVersion.value,
5- " ch.epfl.lamp" % " dotty_0.14 " % scalaVersion.value % " test->runtime" ,
4+ " ch.epfl.lamp" %% " dotty-compiler " % scalaVersion.value,
5+ " ch.epfl.lamp" %% " dotty-compiler " % scalaVersion.value % " test->runtime" ,
66 " com.novocode" % " junit-interface" % " 0.11" % " test"
7- )
7+ )
Original file line number Diff line number Diff line change 1+ package hello
2+
3+ import org .junit .Test
4+
5+ // Import Expr and some extension methods
6+ import scala .quoted ._
7+
8+ class Tests {
9+
10+ implicit val toolbox : scala.quoted.Toolbox = scala.quoted.Toolbox .make(getClass.getClassLoader)
11+
12+ @ Test def test (): Unit = {
13+ import hello .Main ._
14+
15+ val square = stagedPower(2 )
16+
17+ assert(Math .pow(3 , 2 ) == square(3 ))
18+
19+ square(3 )
20+ square(4 )
21+
22+ assert(Math .pow(4 , 2 ) == square(4 ))
23+
24+ val cube = stagedPower(3 )
25+ cube(2 )
26+
27+
28+ assert(Math .pow(2 , 3 ) == cube(2 ))
29+
30+
31+
32+ val toTheFourth = stagedPower(4 )
33+ assert(Math .pow(3 , 4 ) == toTheFourth(3 ))
34+ }
35+
36+ }
Original file line number Diff line number Diff line change 11> run
2+ > test
You can’t perform that action at this time.
0 commit comments