Scala Programming Language
  1. Scala Programming Language
  2. SI-8008

q"foo.bar(..$args)" matches empty arg lists

    Details

      Description

      15:42 ~/Projects/Master (master)$ scala
      Welcome to Scala version 2.11.0-20131122-180524-744425aab4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> val q"$foo.$bar(..$args)" = q"foo.bar"
      foo: reflect.runtime.universe.Tree = foo
      bar: reflect.runtime.universe.Name = bar
      args: List[reflect.runtime.universe.Tree] = List()
      
      scala> q"$foo.$bar(..$args)"
      res0: reflect.runtime.universe.Tree = foo.bar()
      

      Looks like the aforementioned roundtrip adds spurious argument list to argless applications. This is fine for empty-arglist methods, but nullary methods are going to get hurt.

        Activity

        Hide
        Denys Shabalin added a comment -

        This change was introduced to make q"f(..$args)" behave similarly to q"f[..$targs]" but we've not considered the fact that this not applicable here due to different semantics of q"f(..$Nil)" and q"f[..$Nil]". Later case is equivalent to q"f" but former is not.

        Show
        Denys Shabalin added a comment - This change was introduced to make q"f(..$args)" behave similarly to q"f [..$targs] " but we've not considered the fact that this not applicable here due to different semantics of q"f(..$Nil)" and q"f [..$Nil] ". Later case is equivalent to q"f" but former is not.
        Hide
        Denys Shabalin added a comment -

        Fixed in my wip branch.

        Show
        Denys Shabalin added a comment - Fixed in my wip branch.
        Hide
        Denys Shabalin added a comment -
        Show
        Denys Shabalin added a comment - Fixed in https://github.com/scala/scala/pull/3255

          People

          • Assignee:
            Denys Shabalin
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development