forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
24 changed files
with
379 additions
and
32 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
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,13 @@ | ||
package example | ||
|
||
sealed trait Test | ||
|
||
object Test { | ||
case object Foo extends Test | ||
|
||
val visitorType = mkVisitorType[Test] | ||
|
||
trait Visitor[A] { | ||
type V[a] = visitorType.Out[a] | ||
} | ||
} |
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,3 @@ | ||
package example | ||
|
||
val _ = Test.Foo |
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,12 @@ | ||
package example | ||
|
||
import scala.quoted.* | ||
|
||
private def mkVisitorTypeImpl[T: Type](using q: Quotes): Expr[VisitorType[T]] = | ||
'{new VisitorType[T]{}} | ||
|
||
transparent inline def mkVisitorType[T]: VisitorType[T] = ${ mkVisitorTypeImpl[T] } | ||
|
||
trait VisitorType[T] { | ||
type Out[A] | ||
} |
88 changes: 88 additions & 0 deletions
88
tests/coverage/pos/macro-late-suspend/test.scoverage.check
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,88 @@ | ||
# Coverage data, format version: 3.0 | ||
# Statement data: | ||
# - id | ||
# - source path | ||
# - package name | ||
# - class name | ||
# - class type (Class, Object or Trait) | ||
# - full class name | ||
# - method name | ||
# - start offset | ||
# - end offset | ||
# - line number | ||
# - symbol name | ||
# - tree name | ||
# - is branch | ||
# - invocations count | ||
# - is ignored | ||
# - description (can be multi-line) | ||
# '' sign | ||
# ------------------------------------------ | ||
1 | ||
macro-late-suspend/VisitorMacros.scala | ||
example | ||
VisitorMacros$package | ||
Object | ||
example.VisitorMacros$package | ||
mkVisitorTypeImpl | ||
124 | ||
144 | ||
6 | ||
unpickleExprV2 | ||
Apply | ||
false | ||
0 | ||
false | ||
new VisitorType[T]{} | ||
|
||
2 | ||
macro-late-suspend/VisitorMacros.scala | ||
example | ||
VisitorMacros$package | ||
Object | ||
example.VisitorMacros$package | ||
mkVisitorTypeImpl | ||
40 | ||
69 | ||
5 | ||
mkVisitorTypeImpl | ||
DefDef | ||
false | ||
0 | ||
false | ||
private def mkVisitorTypeImpl | ||
|
||
3 | ||
macro-late-suspend/Test.scala | ||
example | ||
Test | ||
Object | ||
example.Test | ||
<init> | ||
102 | ||
121 | ||
8 | ||
<init> | ||
Apply | ||
false | ||
0 | ||
false | ||
mkVisitorType[Test] | ||
|
||
4 | ||
macro-late-suspend/UsesTest.scala | ||
example | ||
UsesTest$package | ||
Object | ||
example.UsesTest$package | ||
<init> | ||
22 | ||
22 | ||
3 | ||
<none> | ||
Literal | ||
true | ||
0 | ||
false | ||
|
||
|
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 @@ | ||
2 |
File renamed without changes.
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,2 @@ | ||
List() | ||
List(abc, def) |
File renamed without changes.
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 @@ | ||
Baz |
File renamed without changes.
File renamed without changes.
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 @@ | ||
>>> hello <<< |
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,8 @@ | ||
import scala.quoted.{Expr, Quotes} | ||
|
||
object Macro: | ||
inline def decorate(inline s: String): String = ${ decorateQuotes('s) } | ||
def decorateQuotes(s: Expr[String])(using Quotes): Expr[String] = '{ ">>> " + $s + " <<<" } | ||
|
||
object Greeting: | ||
def greet() = "hello" |
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,4 @@ | ||
object Test: | ||
def main(args: Array[String]): Unit = | ||
println(Macro.decorate(Greeting.greet())) | ||
|
Oops, something went wrong.