Skip to content

Wrong position on an extension method call #10011

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
adpi2 opened this issue Oct 15, 2020 · 0 comments · Fixed by #10024
Closed

Wrong position on an extension method call #10011

adpi2 opened this issue Oct 15, 2020 · 0 comments · Fixed by #10024

Comments

@adpi2
Copy link
Member

adpi2 commented Oct 15, 2020

Minimized code

I have a macro method that prints the location of the expression that is passed to it:

inline def printPos[T](inline expr: T): Unit =
  ${ printPos('expr) }

private def printPos[T](expr: Expr[T])(using QuoteContext): Expr[Unit] =
  '{ println( ${Expr(expr.unseal.pos.toString) } ) }

Then I can pass a call to an extension method to it:

extension [T](a: T) def foo: Any = ???

@main def Test = printPos(Some(1).foo)

Output

It prints /home/adpi2/test/src/main/scala/App.scala:<81..88> which corresponds to Some(1)

Expectation

The position should contain Some(1).foo

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 16, 2020
@nicolasstucki nicolasstucki linked a pull request Oct 16, 2020 that will close this issue
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Oct 16, 2020
liufengyun added a commit that referenced this issue Oct 19, 2020
Fix #10011: Set missing span of extension selection
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants