-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hijack reflect.ClassManifest definition
- Loading branch information
1 parent
7bf1f60
commit cd683e4
Showing
20 changed files
with
151 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
tests/disabled/reflect/neg/interop_abstypetags_arenot_classmanifests.check
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
tests/disabled/reflect/neg/interop_abstypetags_arenot_classmanifests.scala
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
tests/disabled/reflect/neg/interop_typetags_arenot_classmanifests.check
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
tests/disabled/reflect/neg/interop_typetags_arenot_classmanifests.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
|
||
-- Error: tests/neg/interop_abstypetags_arenot_classmanifests/Test_3.scala:6:40 ---------------------------------------- | ||
6 | println(implicitly[ClassManifest[T]]) // error | ||
| ^ | ||
| No ClassManifest available for T. |
12 changes: 12 additions & 0 deletions
12
tests/neg/interop_abstypetags_arenot_classmanifests/Test_3.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.ClassManifest | ||
|
||
object Test extends App { | ||
def weakTypeTagIsnotClassManifest[T: WeakTypeTag] = { | ||
println(implicitly[ClassManifest[T]]) // error | ||
} | ||
|
||
// weakTypeTagIsnotClassManifest[Int] | ||
// weakTypeTagIsnotClassManifest[String] | ||
// weakTypeTagIsnotClassManifest[Array[Int]] | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/neg/interop_abstypetags_arenot_classmanifests/api_1.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package scala.reflect.api | ||
|
||
trait TypeTags { self: Universe => | ||
trait WeakTypeTag[T] | ||
trait TypeTag[T] extends WeakTypeTag[T] | ||
} | ||
|
||
abstract class Universe extends TypeTags |
7 changes: 7 additions & 0 deletions
7
tests/neg/interop_abstypetags_arenot_classmanifests/universe_2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package scala.reflect | ||
|
||
package object runtime { | ||
|
||
lazy val universe: api.Universe = new api.Universe {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
|
||
-- Error: tests/neg/interop_typetags_arenot_classmanifests/Test_3.scala:6:40 ------------------------------------------- | ||
6 | println(implicitly[ClassManifest[T]]) // error | ||
| ^ | ||
| No ClassManifest available for T. |
12 changes: 12 additions & 0 deletions
12
tests/neg/interop_typetags_arenot_classmanifests/Test_3.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import scala.reflect.runtime.universe._ | ||
import scala.reflect.ClassManifest | ||
|
||
object Test extends App { | ||
def typeTagIsnotClassManifest[T: TypeTag] = { | ||
println(implicitly[ClassManifest[T]]) // error | ||
} | ||
|
||
// typeTagIsnotClassManifest[Int] | ||
// typeTagIsnotClassManifest[String] | ||
// typeTagIsnotClassManifest[Array[Int]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package scala.reflect.api | ||
|
||
trait TypeTags { self: Universe => | ||
trait WeakTypeTag[T] | ||
trait TypeTag[T] extends WeakTypeTag[T] | ||
} | ||
|
||
abstract class Universe extends TypeTags |
7 changes: 7 additions & 0 deletions
7
tests/neg/interop_typetags_arenot_classmanifests/universe_2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package scala.reflect | ||
|
||
package object runtime { | ||
|
||
lazy val universe: api.Universe = new api.Universe {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
@deprecated("Suppress warnings", since="2.11") | ||
object Test extends App { | ||
import scala.reflect.{ClassManifest, ClassTag} | ||
def classTagIsClassManifest[T: ClassTag] = { | ||
println(implicitly[ClassManifest[T]]) | ||
} | ||
|
||
classTagIsClassManifest[Int] | ||
classTagIsClassManifest[String] | ||
classTagIsClassManifest[Array[Int]] | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...run/interop_manifests_are_classtags.scala → ...run/interop_manifests_are_classtags.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scala.collection.immutable.List[scala.Option[Int]] | ||
Array[java.lang.String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import scala.reflect.{ClassManifest, ClassTag} | ||
|
||
type CM[T] = reflect.ClassManifest[T] @annotation.nowarn("msg=deprecated") | ||
type CManifest[T] = CM[T] // test dealiasing mixed with annotated types | ||
|
||
@main def Test = | ||
// manifests are ClassTags | ||
val manifestListOptionInt: ClassTag[List[Option[Int]]] = summon[CManifest[List[Option[Int]]]] | ||
val manifestArrayString: ClassTag[Array[String]] = summon[CManifest[Array[String]]] | ||
|
||
println(manifestListOptionInt) // should print arguments to List | ||
println(manifestArrayString) |