forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
staging.Compiler.make
documentation
This addresses part of scala#19211, scala#19170, and scala#19176
- Loading branch information
1 parent
fa448fb
commit 693a80a
Showing
5 changed files
with
50 additions
and
10 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
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,14 @@ | ||
import scala.quoted.* | ||
|
||
given staging.Compiler = | ||
object Dummy | ||
staging.Compiler.make(Dummy.getClass.getClassLoader) | ||
|
||
class A(i: Int) | ||
|
||
def f(i: Expr[Int])(using Quotes): Expr[A] = { '{ new A($i) } } | ||
|
||
@main def Test = { | ||
val g: Int => A = staging.run { '{ (i: Int) => ${ f('{i}) } } } | ||
println(g(3)) | ||
} |
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.quoted.* | ||
|
||
given staging.Compiler = | ||
object Dummy | ||
staging.Compiler.make(Dummy.getClass.getClassLoader) | ||
|
||
class A | ||
val f: (A, Int) => Int = staging.run { '{ (q: A, x: Int) => x } } | ||
|
||
@main def Test = f(new A, 3) |