Skip to content

wildcards + SAM = </3 #153

Open
Open
@adriaanm

Description

@adriaanm
class P[R]
trait MyChangeListener[T] { def changed(observable: P[_ <: T]) }

class Test {
  // type checks
  def m[S]: MyChangeListener[_ >: S] = new MyChangeListener[S] { def changed(observable: P[_ <: S]): Unit = ??? }

  // should type check too
  def l[S]: MyChangeListener[_ >: S] = (observable: P[_ <: S]) => ???
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions