summaryrefslogtreecommitdiff
path: root/test/files/pos/implicits-new.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-23 16:04:56 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-23 17:54:50 +0200
commit0f0144c74088e396fc1440166bed5a7c6d5f44f4 (patch)
treefd7cc379f1926a3e6a0b94ccb22dd071384cdeb1 /test/files/pos/implicits-new.scala
parent2b09d8caf5497c4e016a3e1179e5f7e842766176 (diff)
downloadscala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.gz
scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.bz2
scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.zip
migrates stdlib and compiler to tags
* all usages of ClassManifest and Manifest are replaced with tags * all manifest tests are replaced with tag tests
Diffstat (limited to 'test/files/pos/implicits-new.scala')
-rw-r--r--test/files/pos/implicits-new.scala89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala
new file mode 100644
index 0000000000..7eb7e100c3
--- /dev/null
+++ b/test/files/pos/implicits-new.scala
@@ -0,0 +1,89 @@
+// #1435
+object t1435 {
+ implicit def a(s:String):String = error("")
+ implicit def a(i:Int):String = error("")
+ implicit def b(i:Int):String = error("")
+}
+
+class C1435 {
+ val v:String = {
+ import t1435.a
+ 2
+ }
+}
+
+// #1492
+class C1492 {
+
+ class X
+
+ def foo(x: X => X) {}
+
+ foo ( implicit x => implicitly[X] )
+ foo { implicit x => implicitly[X] }
+}
+
+// #1579
+object Test1579 {
+ class Column
+ class Query[E](val value: E)
+ class Invoker(q: Any) { val foo = null }
+
+ implicit def unwrap[C](q: Query[C]) = q.value
+ implicit def invoker(q: Query[Column]) = new Invoker(q)
+
+ val q = new Query(new Column)
+ q.foo
+}
+// #1625
+object Test1625 {
+
+ class Wrapped(x:Any) {
+ def unwrap() = x
+ }
+
+ implicit def byName[A](x: =>A) = new Wrapped(x)
+
+ implicit def byVal[A](x: A) = x
+
+ def main(args: Array[String]) = {
+
+// val res:Wrapped = 7 // works
+
+ val res = 7.unwrap() // doesn't work
+
+ println("=> result: " + res)
+ }
+}
+
+object Test2188 {
+ implicit def toJavaList[A: ArrayTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*)
+
+ val x: java.util.List[String] = List("foo")
+}
+
+object TestNumericWidening {
+ val y = 1
+ val x: java.lang.Long = y
+}
+
+// #2709
+package foo2709 {
+ class A
+ class B
+
+ package object bar {
+ implicit def a2b(a: A): B = new B
+ }
+
+ package bar {
+ object test {
+ new A: B
+ }
+ }
+}
+
+// Problem with specs
+object specsProblem {
+ println(implicitly[ConcreteTypeTag[Class[_]]])
+}