-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore types in macro runtime dependencies
We can have different kinds of type references in the contents of a splice. We do not care about types because those are erased and the interpreter emulates erased semantics. These types are in `Tree`s that extend `TypeTree` or `RefTree` referring to type. Fixes #12498
- Loading branch information
1 parent
7d6d42f
commit 7ccd826
Showing
9 changed files
with
46 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import scala.quoted.* | ||
|
||
class Wrapper[T](t: T): | ||
inline def showType: String = ${ Wrapper.showTypeImpl[T]} | ||
|
||
object Wrapper: | ||
def showTypeImpl[U](using Quotes): Expr[String] = Expr("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,3 @@ | ||
class Person | ||
|
||
def test = Wrapper(new Person).showType |
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,7 @@ | ||
import scala.quoted.* | ||
|
||
class Wrapper[T](t: T): | ||
inline def showType: String = ${ Wrapper.showTypeImpl[T]} | ||
|
||
object Wrapper: | ||
def showTypeImpl[U](using Quotes): Expr[String] = Expr("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,3 @@ | ||
class Person | ||
|
||
def test = Wrapper(new Person).showType |
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.* | ||
|
||
|
||
class Wrapper[T](t: T): | ||
inline def nothing: T = ${ Wrapper.nothing : Expr[T] } | ||
|
||
object Wrapper: | ||
def nothing(using Quotes): Expr[Nothing] = '{???} |
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 @@ | ||
class Person | ||
|
||
def test = Wrapper(new Person).nothing |
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.* | ||
|
||
|
||
class Wrapper[T](t: T): | ||
inline def emptyList: List[T] = ${ Wrapper.emptyListImpl : Expr[List[T]] } | ||
|
||
object Wrapper: | ||
def emptyListImpl(using Quotes): Expr[List[Nothing]] = Expr(Nil) |
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 @@ | ||
class Person | ||
|
||
def test = Wrapper(new Person).emptyList |