Skip to content

NoSuchMethodError on invocation on structural type with polymorphic result type #3669

Open
@scabug

Description

@scabug

The following compiles, but leads to a !NoSuchMethodException when run, when the method $$plus is looked for in Integer:

java.lang.!NoSuchMethodException: java.lang.Integer.$$plus(int)

I'm running the latest nightly build of the tycho-reorg branch of the Scala IDE for Eclipse.

object Main extends Application {
    val o = new Obj1
    
    o.incProperty(o.field _, o.field_= _)
    
}

class Obj1 {

  type Setter[T] = T => Unit
  type Getter[T] = () => T

  var field: Int = 4

  def incProperty[T <: Any{ def +(a: Int): T } ](get: Getter[T], set: Setter[T]) = {
  	set(get() + 1)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions