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

generic signatures must account for value class erasure rules

    Details

      Description

        scala> class Val[A](val value: Int) extends AnyVal
        defined class Val
      
        scala> class C2 { def foo[A](in: Val[A]) = in }
        defined class C2
      
        scala> classOf[C2].getMethods.head
        res4: java.lang.reflect.Method = public int C2.foo(int)
      
        scala> res4.getGenericParameterTypes
        res5: Array[java.lang.reflect.Type] = Array(.Val<A>)
      

      That's bad, m'kay.

      Discussion: https://groups.google.com/d/topic/scala-sips/KSm99KoiYNA/discussion

        Issue Links

          Activity

          Hide
          Mark Harrah added a comment -

          Possibly related comment from Paolo in SI-3452: "classes extending AnyVal are erased correctly, but not in generic signatures"

          https://issues.scala-lang.org/browse/SI-3452?focusedCommentId=57837&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-57837

          Show
          Mark Harrah added a comment - Possibly related comment from Paolo in SI-3452 : "classes extending AnyVal are erased correctly, but not in generic signatures" https://issues.scala-lang.org/browse/SI-3452?focusedCommentId=57837&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-57837
          Hide
          Aleksandar Prokopec added a comment -

          Assigned to you Paul based upon the suggestion on the Scala meeting

          Show
          Aleksandar Prokopec added a comment - Assigned to you Paul based upon the suggestion on the Scala meeting
          Show
          Paul Phillips added a comment - https://github.com/scala/scala/pull/1345
          Hide
          Grzegorz Kossakowski added a comment -

          Paul said (in https://github.com/scala/scala/pull/1345):

          I'm not enormously confident that I'm generating the right signatures, but it's closer at worst.

          I'm actually getting more confident so I'll mark this as fixed. Please reopen if you find issues with generic signatures and value classes.

          Show
          Grzegorz Kossakowski added a comment - Paul said (in https://github.com/scala/scala/pull/1345): I'm not enormously confident that I'm generating the right signatures, but it's closer at worst. I'm actually getting more confident so I'll mark this as fixed. Please reopen if you find issues with generic signatures and value classes.

            People

            • Assignee:
              Paul Phillips
              Reporter:
              Jason Zaugg
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development