Skip to content

Commit c8c76b5

Browse files
committed
add Manifest tests
1 parent e1f50d6 commit c8c76b5

File tree

42 files changed

+172
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+172
-79
lines changed

tests/disabled/reflect/neg/interop_abstypetags_arenot_classtags.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_abstypetags_arenot_classtags.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_abstypetags_arenot_manifests.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_abstypetags_arenot_manifests.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_classtags_arenot_manifests.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_typetags_arenot_classtags.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_typetags_arenot_classtags.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_typetags_without_classtags_arenot_manifests.check

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/disabled/reflect/neg/interop_typetags_without_classtags_arenot_manifests.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/disabled/reflect/run/interop_typetags_are_manifests.check

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/disabled/reflect/run/interop_typetags_are_manifests.flags

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
-- Error: tests/neg/interop_abstypetags_arenot_classtags/Test_3.scala:6:23 ---------------------------------------------
4+
6 | println(classTag[T]) // error
5+
| ^
6+
| No ClassTag available for T
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import scala.reflect.runtime.universe._
2+
import scala.reflect.classTag
3+
4+
object Test extends App {
5+
def weakTypeTagIsnotClassTag[T: WeakTypeTag] = {
6+
println(classTag[T]) // error
7+
}
8+
9+
// weakTypeTagIsnotClassTag[Int]
10+
// weakTypeTagIsnotClassTag[String]
11+
// weakTypeTagIsnotClassTag[Array[Int]]
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package scala.reflect.api
2+
3+
trait TypeTags { self: Universe =>
4+
trait WeakTypeTag[T]
5+
trait TypeTag[T] extends WeakTypeTag[T]
6+
}
7+
8+
abstract class Universe extends TypeTags
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect
2+
3+
package object runtime {
4+
5+
lazy val universe: api.Universe = new api.Universe {}
6+
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
-- Error: tests/neg/interop_abstypetags_arenot_manifests/Test_3.scala:5:23 ---------------------------------------------
4+
5 | println(manifest[T]) // error
5+
| ^
6+
| No Manifest available for T.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.reflect.runtime.universe._
2+
3+
object Test extends App {
4+
def weakTypeTagIsnotManifest[T: WeakTypeTag] = {
5+
println(manifest[T]) // error
6+
}
7+
8+
// weakTypeTagIsnotManifest[Int]
9+
// weakTypeTagIsnotManifest[String]
10+
// weakTypeTagIsnotManifest[Array[Int]]
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package scala.reflect.api
2+
3+
trait TypeTags { self: Universe =>
4+
trait WeakTypeTag[T]
5+
trait TypeTag[T] extends WeakTypeTag[T]
6+
}
7+
8+
abstract class Universe extends TypeTags
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect
2+
3+
package object runtime {
4+
5+
lazy val universe: api.Universe = new api.Universe {}
6+
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Error: tests/neg/interop_classtags_arenot_manifests.scala:5:23 ------------------------------------------------------
2+
5 | println(manifest[T]) // error
3+
| ^
4+
| No Manifest available for T.

tests/disabled/reflect/neg/interop_classtags_arenot_manifests.scala renamed to tests/neg/interop_classtags_arenot_manifests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.reflect.{ClassTag, classTag}
22

33
object Test extends App {
44
def classTagIsnotManifest[T: ClassTag] = {
5-
println(manifest[T])
5+
println(manifest[T]) // error
66
}
77

88
classTagIsnotManifest[Int]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
-- Error: tests/neg/interop_typetags_arenot_classtags/Test_3.scala:6:23 ------------------------------------------------
4+
6 | println(classTag[T]) // error
5+
| ^
6+
| No ClassTag available for T
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import scala.reflect.runtime.universe._
2+
import scala.reflect.classTag
3+
4+
object Test extends App {
5+
def typeTagIsnotClassTag[T: TypeTag] = {
6+
println(classTag[T]) // error
7+
}
8+
9+
// typeTagIsnotClassTag[Int]
10+
// typeTagIsnotClassTag[String]
11+
// typeTagIsnotClassTag[Array[Int]]
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect.api
2+
3+
trait TypeTags { self: Universe =>
4+
trait TypeTag[T]
5+
}
6+
7+
abstract class Universe extends TypeTags
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect
2+
3+
package object runtime {
4+
5+
lazy val universe: api.Universe = new api.Universe {}
6+
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
-- Error: tests/neg/interop_typetags_without_classtags_arenot_manifests/Test_3.scala:5:23 ------------------------------
4+
5 | println(manifest[T]) // error
5+
| ^
6+
| To create a Manifest here, it is necessary to interoperate with the
7+
| TypeTag `evidence$1` in scope. However TypeTag to Manifest conversion requires a
8+
| ClassTag for the corresponding type to be present.
9+
| To proceed add a ClassTag for the type `T` (e.g. by introducing a context bound)
10+
| and recompile.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.reflect.runtime.universe._
2+
3+
object Test extends App {
4+
def typeTagWithoutClassTagIsnotManifest[T: TypeTag] = {
5+
println(manifest[T]) // error
6+
}
7+
8+
// typeTagWithoutClassTagIsnotManifest[Int]
9+
// typeTagWithoutClassTagIsnotManifest[String]
10+
// typeTagWithoutClassTagIsnotManifest[Array[Int]]
11+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect.api
2+
3+
trait TypeTags { self: Universe =>
4+
trait TypeTag[T]
5+
}
6+
7+
abstract class Universe extends TypeTags
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package scala.reflect
2+
3+
package object runtime {
4+
5+
lazy val universe: api.Universe = new api.Universe {}
6+
7+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import scala.reflect.runtime.universe._
22
import scala.reflect.ClassTag
3-
import internal._
43

5-
object Test extends App {
4+
object Test {
65
def typeTagIsManifest[T: TypeTag : ClassTag] = {
76
println(manifest[T])
87
}
98

10-
typeTagIsManifest[Int]
11-
typeTagIsManifest[String]
12-
typeTagIsManifest[Array[Int]]
9+
// typeTagIsManifest[Int]
10+
// typeTagIsManifest[String]
11+
// typeTagIsManifest[Array[Int]]
1312
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package scala.reflect.api
2+
3+
import scala.reflect.{Manifest, ClassTag}
4+
5+
trait TypeTags { self: Universe =>
6+
trait TypeTag[T]
7+
}
8+
9+
trait Internals { self: Universe =>
10+
11+
object internal {
12+
def typeTagToManifest[T: ClassTag](mirror: Any, tag: Universe#TypeTag[T]): Manifest[T] = ???
13+
}
14+
15+
}
16+
17+
abstract class Universe extends TypeTags
18+
with Internals
19+
20+
abstract class JavaUniverse extends Universe {
21+
def runtimeMirror(cl: ClassLoader): Any = ???
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package scala.reflect
2+
3+
import scala.reflect.api
4+
5+
package object runtime {
6+
7+
lazy val universe: api.JavaUniverse = new api.JavaUniverse {}
8+
9+
}
File renamed without changes.

0 commit comments

Comments
 (0)