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.
Avoid instrumentation of inline and erased definitions
These methods will not generate code and therefore do not need to be instrumented. Note that a retained inline method will have a `$retained` variant that will be instrumented. Found this issue while looking into scala#15490.
- Loading branch information
1 parent
4e5e055
commit 7206bfe
Showing
9 changed files
with
351 additions
and
80 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 @@ | ||
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,13 @@ | ||
import scala.language.experimental.erasedDefinitions | ||
|
||
class A: | ||
erased def x: String = "x".toString | ||
def foo(erased s: String): String = "foo" | ||
|
||
@main | ||
def Test: Unit = | ||
val a = A() | ||
// FIXME: coverage should not track erased arguments and statements | ||
// a.x | ||
// println(a.foo(a.x)) | ||
println("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,89 @@ | ||
# 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 | ||
# ------------------------------------------ | ||
0 | ||
erased-def/test.scala | ||
<empty> | ||
A | ||
Class | ||
<empty>.A | ||
foo | ||
103 | ||
110 | ||
4 | ||
foo | ||
DefDef | ||
false | ||
0 | ||
false | ||
def foo | ||
|
||
1 | ||
erased-def/test.scala | ||
<empty> | ||
test$package$ | ||
Object | ||
<empty>.test$package$ | ||
Test | ||
179 | ||
182 | ||
8 | ||
<init> | ||
Apply | ||
false | ||
0 | ||
false | ||
A() | ||
|
||
2 | ||
erased-def/test.scala | ||
<empty> | ||
test$package$ | ||
Object | ||
<empty>.test$package$ | ||
Test | ||
289 | ||
303 | ||
12 | ||
println | ||
Apply | ||
false | ||
0 | ||
false | ||
println("foo") | ||
|
||
3 | ||
erased-def/test.scala | ||
<empty> | ||
test$package$ | ||
Object | ||
<empty>.test$package$ | ||
Test | ||
146 | ||
160 | ||
7 | ||
Test | ||
DefDef | ||
false | ||
0 | ||
false | ||
@main | ||
def Test | ||
|
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 @@ | ||
1 | ||
foo | ||
bar | ||
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,18 @@ | ||
abstract class B: | ||
val x: Int | ||
def foo: String | ||
|
||
class A extends B: | ||
inline val x = 1 | ||
inline val y = 2 | ||
inline def foo: String = "foo".toString | ||
inline def bar: String = "bar".toString | ||
|
||
@main | ||
def Test: Unit = | ||
val a = A() | ||
println(a.x) | ||
println(a.foo) | ||
println(a.bar) | ||
val b: B = a | ||
println(b.foo) |
Oops, something went wrong.