aboutsummaryrefslogtreecommitdiff
path: root/tests/run
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-01-07 14:47:18 +0700
committerMartin Odersky <odersky@gmail.com>2017-01-07 14:47:18 +0700
commit69feaa89167ebeb708535dd4abf3a79a410130f0 (patch)
treeec93cdc0b05ccb22628ca9dee454e33e4df3e8ee /tests/run
parent7e3f69ace983adfbc9bbf44954f9a5845add3d43 (diff)
downloaddotty-69feaa89167ebeb708535dd4abf3a79a410130f0.tar.gz
dotty-69feaa89167ebeb708535dd4abf3a79a410130f0.tar.bz2
dotty-69feaa89167ebeb708535dd4abf3a79a410130f0.zip
Change scheme to use Selectable
Use base types instead of implicits. This is more robust in the presence of type abstraction.
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/structural.scala16
-rw-r--r--tests/run/structuralNoSuchMethod.scala2
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;