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

Error type sneaks into annotation arguments

    Details

      Description

      Views should not be allowed when typing the arguments of annotations.

      This is one way the problem manifests:

      ~/code/scala scala29
      Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> implicit def intToGroup(i: Int) = Specializable.Integral
      <console>:7: error: not found: value Specializable
             implicit def intToGroup(i: Int) = Specializable.Integral
                                               ^
      
      scala> class foo(a: String) extends StaticAnnotation
      defined class foo
      
      scala> implicit def i2s(i: Int) = ""
      i2s: (i: Int)java.lang.String
      
      scala> @foo(1: String) def blerg {}
      blerg: Unit
      
      ~/code scala210
      Welcome to Scala version 2.10.0-20120504-065643-e52be82eef (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      
      scala> class foo(a: String) extends annotation.StaticAnnotation
      defined class foo
      
      scala> implicit def i2s(i: Int) = ""
      warning: there were 1 feature warnings; re-run with -feature for details
      i2s: (i: Int)String
      
      scala> @foo(1: String) def blerg {}
      <console>:9: error: type mismatch;
       found   : Int(1)
       required: String
             @foo(1: String) def blerg {}
                  ^
      error: 
           while compiling:  <console>
             current phase:  pickler
           library version:  version 2.10.0-20120504-065643-e52be82eef
          compiler version:  version 2.10.0-20120504-065643-e52be82eef
        reconstructed args:  
      
      uncaught exception during compilation: scala.reflect.internal.FatalError
      scala.reflect.internal.FatalError: bad type: <error>(class scala.reflect.internal.Types$ErrorType$)
              at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putType(Pickler.scala:226)
      
      

        Activity

        Hide
        Jason Zaugg added a comment -

        Yep, I saw a LazyType along the way. I think the main priority is to fix the implicit scoping problem, that is, make the code in my previous comment illegal.

        Show
        Jason Zaugg added a comment - Yep, I saw a LazyType along the way. I think the main priority is to fix the implicit scoping problem, that is, make the code in my previous comment illegal.
        Hide
        Jason Zaugg added a comment -

        This does the job, but I'm pretty clueless in the land of Namers, so consider it more a sketch than the finished article.

        https://github.com/retronym/scala/commits/ticket/5892

        Show
        Jason Zaugg added a comment - This does the job, but I'm pretty clueless in the land of Namers, so consider it more a sketch than the finished article. https://github.com/retronym/scala/commits/ticket/5892
        Hide
        Jason Zaugg added a comment -

        @Lukas: I'm a bit stuck on this one; could you please take if from here?

        https://github.com/scala/scala/pull/687#issuecomment-6477146

        Show
        Jason Zaugg added a comment - @Lukas: I'm a bit stuck on this one; could you please take if from here? https://github.com/scala/scala/pull/687#issuecomment-6477146
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/909
        Show
        Lukas Rytz added a comment - fixed in https://github.com/scala/scala/commit/776105a43ef7a7a7c32be8111b496a6762a8ac68

          People

          • Assignee:
            Lukas Rytz
            Reporter:
            Jason Zaugg
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development