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

Type parameter gets applied to wrong invocation in selectDynamic expansion

    Details

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

      Description

      import language.dynamics
      
      class Dyn extends Dynamic {
        def selectDynamic(s: String): Dyn = new Dyn
        def get[T]: T = null.asInstanceOf[T]
      }
      
      object Foo {
        val dyn = new Dyn
        dyn.foo.bar.baz.get[String]
      }
      
      dynamic.scala:10: error: method selectDynamic: (s: String)Dyn does not take type parameters
      error after rewriting to Foo.this.dyn.selectDynamic[String]("foo")
      possible cause: maybe a wrong Dynamic method signature?
        dyn.foo.bar.baz.get[String]
        ^
      one error found
      

      It looks like the fix to SI-6320 (incidentally not marked as resolved yet, but the fix is in 2.10-RC2) applies the type parameter to the selectDynamic method, instead of the get method.

        Activity

        Show
        Paul Phillips added a comment - https://github.com/scala/scala/pull/1681
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/commit/edbcc64483ac0009eeeb58fe31e57a411da9e4c6

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Jon Pretty
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development