Skip to content

sourcecode.Name does not capture back ticked macro keyword in Scala3 (200USD Bounty) #120

Closed

Description

@carueda

Scastie: https://scastie.scala-lang.org/carueda/NIAVkP82Rd2RVusUXRZMGQ/13

In short, applying:

def keyword(implicit name: sourcecode.Name): String = name.value

to back ticked macro:

val `macro` = keyword

results in capturing something else, apparently the name of the enclosing environment, but not the val's name itself.

Other Scala keywords seem to be captured just fine.

Haoyi: To incentivize contribution, I'm putting a 200USD bounty on resolving this ticket. This is payable via bank transfer, and at my discretion in case of ambiguity. The acceptance criteria is a PR fixing this issue and updates to our test infrastructure to validate the fix

Activity

  1. carueda commented on Aug 3, 2022

    @carueda
    Author

    though nobody seems to care, fwiw, just reproduced this with Scala 3.1.3 and sourcecode 0.3.0

    Screen Shot 2022-08-02 at 8 01 07 PM

    java.lang.AssertionError: assertion failed: `macro` == "Playground" not "macro" !
    	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
    	at Playground$.<clinit>(main.scala:10)
    	at Main$.<clinit>(main.scala:15)
    	at Main.main(main.scala)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    	at sbt.Run.invokeMain(Run.scala:143)
    	at sbt.Run.execute$1(Run.scala:93)
    	at sbt.Run.$anonfun$runWithLoader$5(Run.scala:120)
    	at sbt.Run$.executeSuccess(Run.scala:186)
    	at sbt.Run.runWithLoader(Run.scala:120)
    	at sbt.Run.run(Run.scala:127)
    	at com.olegych.scastie.sbtscastie.SbtScastiePlugin$$anon$1.$anonfun$run$1(SbtScastiePlugin.scala:38)
    	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    	at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
    	at sbt.ScastieTrapExit$App.run(ScastieTrapExit.scala:259)
    	at java.base/java.lang.Thread.run(Thread.java:831)
    
  2. changed the title [-]sourcecode.Name does not capture back ticked `macro` keyword in Scala3[/-] [+]sourcecode.Name does not capture back ticked `macro` keyword in Scala3 (200USD Bounty)[/+] on May 14, 2024
  3. KacperFKorban commented on May 14, 2024

    @KacperFKorban
    Contributor

    Hi, I'd like to take a crack at it

  4. lihaoyi commented on May 14, 2024

    @lihaoyi
    Member

    @KacperFKorban go for it, no need to ask permission!

  5. carueda commented on May 22, 2024

    @carueda
    Author

    awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions