-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix coverage serialization when encountering macro suspension #22303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
817d72f
66ad0cd
d07040d
f7b2aa5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package example | ||
|
||
val _ = Test.Foo |
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] | ||
} |
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 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
List() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this name also wrong btw? i182233-min.check has an added 2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Weird that the added assertion does not throw... I'll try to look at this closer tomorrow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see the issue - for that one, the first file returned by the iterator is actually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ach, so not a big deal then |
||
List(abc, def) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Baz |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
>>> hello <<< |
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" |
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())) | ||
|
Uh oh!
There was an error while loading. Please reload this page.