File tree Expand file tree Collapse file tree 9 files changed +46
-2
lines changed
compiler/src/dotty/tools/dotc/inlines Expand file tree Collapse file tree 9 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -1046,9 +1046,9 @@ class Inliner(val call: tpd.Tree)(using Context):
10461046 new TreeAccumulator [List [Symbol ]] {
10471047 private var level = - 1
10481048 override def apply (syms : List [Symbol ], tree : tpd.Tree )(using Context ): List [Symbol ] =
1049- if ( level != - 1 ) foldOver(syms, tree)
1049+ if level != - 1 then foldOver(syms, tree)
10501050 else tree match {
1051- case tree : RefTree if level == - 1 && tree.symbol.isDefinedInCurrentRun && ! tree.symbol.isLocal =>
1051+ case tree : RefTree if tree.isTerm && tree.symbol.isDefinedInCurrentRun && ! tree.symbol.isLocal =>
10521052 foldOver(tree.symbol :: syms, tree)
10531053 case Quoted (body) =>
10541054 level += 1
@@ -1062,6 +1062,8 @@ class Inliner(val call: tpd.Tree)(using Context):
10621062 level -= 1
10631063 try apply(syms, body)
10641064 finally level += 1
1065+ case _ : TypTree =>
1066+ syms
10651067 case _ =>
10661068 foldOver(syms, tree)
10671069 }
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+ class Wrapper [T ](t : T ):
4+ inline def showType : String = $ { Wrapper .showTypeImpl[T ]}
5+
6+ object Wrapper :
7+ def showTypeImpl [U ](using Quotes ): Expr [String ] = Expr (" foo" )
Original file line number Diff line number Diff line change 1+ class Person
2+
3+ def test = Wrapper (new Person ).showType
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+ class Wrapper [T ](t : T ):
4+ inline def showType : String = $ { Wrapper .showTypeImpl[T ]}
5+
6+ object Wrapper :
7+ def showTypeImpl [U ](using Quotes ): Expr [String ] = Expr (" foo" )
Original file line number Diff line number Diff line change 1+ class Person
2+
3+ def test = Wrapper (new Person ).showType
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+
4+ class Wrapper [T ](t : T ):
5+ inline def nothing : T = $ { Wrapper .nothing : Expr [T ] }
6+
7+ object Wrapper :
8+ def nothing (using Quotes ): Expr [Nothing ] = ' {??? }
Original file line number Diff line number Diff line change 1+ class Person
2+
3+ def test = Wrapper (new Person ).nothing
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+
4+ class Wrapper [T ](t : T ):
5+ inline def emptyList : List [T ] = $ { Wrapper .emptyListImpl : Expr [List [T ]] }
6+
7+ object Wrapper :
8+ def emptyListImpl (using Quotes ): Expr [List [Nothing ]] = Expr (Nil )
Original file line number Diff line number Diff line change 1+ class Person
2+
3+ def test = Wrapper (new Person ).emptyList
You can’t perform that action at this time.
0 commit comments