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

Passing self-reference to varargs super constructor causes VerifyError

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: Scala 2.10.1
    • Component/s: Compiler Backend
    • Environment:

      Debian Linux, 64-bit (LMDE)
      Sun JDK 1.7.0
      Scala 2.10.0 final (which wasn't in the "Affects Version/s" list, so I put RC5)

      Description

      According to PaulP, this is "another variation on SI-473 (and later, SI-3913)" – code compiles but causes a VerifyError when loaded.

      Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0).
      Type in expressions to have them evaluated.
      Type :help for more information.

      scala> abstract class A( val someAs: A* )
      defined class A

      scala> object B extends A(B)
      defined module B

      scala> B.someAs
      java.lang.VerifyError: (class: B$, method: <init> signature: ()V) Expecting to find object/array on stack

      When I pass in a Set rather than a varargs list, I get a reasonable error:

      scala> abstract class A( val someAs: Set[A] )
      defined class A

      scala> object B extends A(Set(B))
      <console>:11: error: super constructor cannot be passed a self reference unless parameter is declared by-name
      object B extends A(Set(B))

        Activity

        Show
        Paul Phillips added a comment - https://github.com/scala/scala/pull/1853
        Hide
        Grzegorz Kossakowski added a comment -

        From mailing list:
        > By the way, 2.10.0 was not in the Affects Version/s pulldown, so I put 2.10.0-RC5.

        It's there now so I fixed that.

        Show
        Grzegorz Kossakowski added a comment - From mailing list: > By the way, 2.10.0 was not in the Affects Version/s pulldown, so I put 2.10.0-RC5. It's there now so I fixed that.
        Hide
        Jason Zaugg added a comment -

        We forgot to close this ticket after Paul's patch was merged.

        Show
        Jason Zaugg added a comment - We forgot to close this ticket after Paul's patch was merged.

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Nicholas Sterling
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development