diff options
Diffstat (limited to 'tests/run')
-rw-r--r-- | tests/run/structural.scala | 16 | ||||
-rw-r--r-- | tests/run/structuralNoSuchMethod.scala | 2 |
2 files changed, 5 insertions, 13 deletions
diff --git a/tests/run/structural.scala b/tests/run/structural.scala index 43f008b5f..0f18f4579 100644 --- a/tests/run/structural.scala +++ b/tests/run/structural.scala @@ -1,22 +1,14 @@ -case class Record(elems: (String, Any)*) - -object Record { - - implicit def projector: Projector[Record] = new Projector[Record] { - def get(receiver: Record, name: String): Any = - receiver.elems.find(_._1 == name).get._2 - } - +case class Record(elems: (String, Any)*) extends Selectable { + def selectDynamic(name: String): Any = elems.find(_._1 == name).get._2 } object Test { - import scala.reflect.Projector.reflectiveProjector - import Record.projector + import scala.reflect.Selectable.reflectiveSelectable def f(closeable: { def close(): Unit }) = closeable.close() - type RN = Record { val name: String } + type RN = Record { val name: String; val age: Int } def g(r: RN) = r.name diff --git a/tests/run/structuralNoSuchMethod.scala b/tests/run/structuralNoSuchMethod.scala index 3d33c9d8b..476d7ed82 100644 --- a/tests/run/structuralNoSuchMethod.scala +++ b/tests/run/structuralNoSuchMethod.scala @@ -1,4 +1,4 @@ -import scala.reflect.Projector.reflectiveProjector +import scala.reflect.Selectable.reflectiveSelectable /** Demonstrates limitation of structural method dispatch (in Scala 2.x and dotty). * The method must be defined at exactly the argument types given in the structural type; |