Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

structural type manifests #4252

Closed
scabug opened this issue Feb 14, 2011 · 3 comments
Closed

structural type manifests #4252

scabug opened this issue Feb 14, 2011 · 3 comments

Comments

@scabug
Copy link

scabug commented Feb 14, 2011

[Edit: replaced original report with more distilled illustration.]

scala> manifest[{ def x: Int }]
<console>:8: error: type mismatch;
 found   : scala.reflect.Manifest[java.lang.Object]
 required: Manifest[AnyRef{def x: Int}]
@scabug
Copy link
Author

scabug commented Feb 14, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4252?orig=1
Reporter: ukasz Lew (lukaszlew)

@scabug
Copy link
Author

scabug commented Feb 15, 2011

@axel22 said:
With trunk the error message is:

scala> val a = Array[{def x: Int}](new { def x = 3 })
<console>:7: error: type mismatch;
 found   : scala.reflect.Manifest[java.lang.Object]
 required: scala.reflect.ClassManifest[AnyRef{def x: Int}]
Note: java.lang.Object >: AnyRef{def x: Int}, but trait ClassManifest is invariant in type T.
You may wish to investigate a wildcard type such as `_ >: AnyRef{def x: Int}`. (SLS 3.2.10)
       val a = Array[{def x: Int}](new { def x = 3 })

@scabug
Copy link
Author

scabug commented May 27, 2012

@xeno-by said:
Scala 2.10.0-M3 includes type tags (which may be renamed by the time 2.10.0-final hits). Type tags are thin wrappers over compiler's Types, which means that they support all intricacies of Scala's type system.

Welcome to Scala version 2.10.0-20120527-185059-965b03e100 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> typeOf[{ def x: Int }]
res0: reflect.runtime.universe.Type = java.lang.Object{def x: scala.Int}

Type tags are now a recommended way to reify types, and manifests are deprecated. Hence we won't implement any new functionality for manifests.

@scabug scabug closed this as completed May 27, 2012
@scabug scabug added this to the 2.10.0-M3 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant