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

Call of updateDynamic results in NoPosition error

    Details

      Description

      A call of an updateDynamic method results in a NoPosition error:

      object X {
        val d = new D
        d.field = 10
        d.field
      }
      import language.dynamics
      class D extends Dynamic {
        var map = Map.empty[String, Any]
        def selectDynamic(name: String) =
          map(name)
        def updateDynamic(name: String)(value: Any) {
          map += name -> value
        }
      }
      

      Compiled with scalac -Yrangepos -Xprint-pos -Xprint:typer -Ystop-after:typer x.scala:

      ======= Position error
      Unpositioned tree #448
         unpositioned [L  -1 P#  478] #448    [NoPosition]    Apply      // Apply(method updateDynamic)
            enclosing [L   1        ] #478    [9:53]          Template   // {
              sibling [L   6 P#  478] #59     [54]            Select     // Select(Ident(scala), AnyRef)
              sibling [L  -1 P#  478] #41     [NoPosition]    emptyValDef // term _
              sibling [L   1 P#  478] #67     [9]             DefDef     // term <init>
              sibling [L   2 P#  478] #282    [13:26]         ValDef     // d = new D
              sibling [L   2 P#  478] #286    [17]            DefDef     // term d
              sibling [L  -1 P#  478] #448    [NoPosition]    Apply      // Apply(method updateDynamic)
              sibling [L   4 P#  478] #453    [44:45]         Apply      // d.
      
      While validating #570
      [L   1        ] #570    [0:268]         PackageDef // object X {
      
      Children:
        [L   1 P#  570] #120    [0:0]           Ident      // o
        [L   1 P#  570] #479    [0:53]          ModuleDef  // X {
        [L   6 P#  570] #482    [54:78]         Import     // language.dynamics
        [L   7 P#  570] #569    [79:268]        ClassDef   // D extends Dynamic {
      =======
      error: 
           while compiling: x.scala
              during phase: typer
           library version: version 2.10.1
          compiler version: version 2.10.1
        reconstructed args: -Yrangepos -Xprint-pos -Xprint:typer -Ystop-after:typer
      
        last tree to typer: Apply(method ->)
                    symbol: method -> in class ArrowAssoc (flags: <method> <triedcooking>)
         symbol definition: def ->[B](y: B): (A, B)
                       tpe: (String, Any)
             symbol owners: method -> -> class ArrowAssoc -> object Predef -> package scala
            context owners: method updateDynamic -> class D -> package <empty>
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Simon Schäfer
            Reporter:
            Simon Schäfer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development