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

Symbols declared in an annotation conflict with members declared nearby

    Details

      Description

      Compile this file first:

      class ann(val bar: Any) extends StaticAnnotation
      
      object Api {
        @ann({def foo = "foo!!"})
        def foo = println("foo")
      }
      

      Now compile the second file having classes of the first on the classpath:

      object Test extends App {
        Api.foo
      }
      

      Here we go:

      D:\Dropbox\Scratchpad\Scala\Test2.scala:2: error: ambiguous reference to overloaded definition,
      both method foo in object Api of type => String
      and  method foo in object Api of type => Unit
      match expected type ?
        Api.foo
            ^
      one error found
      

      If both files are compiled in a single compilation run, everything is fine.

        Activity

        Hide
        Paul Phillips added a comment -

        The Society for the Prevention of Regressions notes with relief that the same behavior exists since at least 2.8.

        Show
        Paul Phillips added a comment - The Society for the Prevention of Regressions notes with relief that the same behavior exists since at least 2.8.
        Show
        Lukas Rytz added a comment - fixed with https://github.com/scala/scala/commit/9c6a7ad81bdb632d3da144d58210b5903b86a3e4

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development