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
Compiler cannot determine implicit Manifest for type constructor #2915
Comments
Imported From: https://issues.scala-lang.org/browse/SI-2915?orig=1 |
@adriaanm said: not sure whether this is the way to go, though... |
@adriaanm said: given def classOfHK[T @uncheckedKind]
class ManifestHK[T @uncheckedKind]
def classTypeHK[T @uncheckedKind](clazz: Predef.Class[_]): Manifest[T] = ...
|
@odersky said: |
@adriaanm said: |
Alexey Tarasevich (xetas) said: scala> def f(implicit a: Manifest[{def g: Unit}]) = a
f: (implicit a: Manifest[AnyRef{def g: Unit}])Manifest[AnyRef{def g: Unit}]
scala> f
<console>:6: error: type mismatch;
found : scala.reflect.Manifest[AnyRef]
required: Manifest[AnyRef{def g: Unit}]
f
^ |
@soc said: scala> def f(implicit a: Manifest[{def g: Unit}]) = a
f: (implicit a: scala.reflect.Manifest[AnyRef{def g: Unit}])scala.reflect.Manifest[AnyRef{def g: Unit}]
scala> f
<console>:8: error: type mismatch;
found : scala.reflect.Manifest[java.lang.Object]
required: scala.reflect.Manifest[AnyRef{def g: Unit}]
Note: java.lang.Object >: AnyRef{def g: Unit}, but trait Manifest is invariant in type T.
You may wish to investigate a wildcard type such as `_ >: AnyRef{def g: Unit}`. (SLS 3.2.10)
f
^ |
@harrah said: |
@harrah said: |
@adriaanm said: |
@harrah said: |
@adriaanm said: |
@harrah said: For the workaround, I managed to get something along the lines of a type member working for my purposes. |
@retronym said: scala> class M[A]; class O[A, B[_]]
warning: there were 1 feature warning(s); re-run with -feature for details
defined class M
defined class O
scala> implicitly[reflect.runtime.universe.TypeTag[O[String, M]]]
res27: reflect.runtime.universe.TypeTag[O[String,M]] = TypeTag[O[String,M]]
scala> implicitly[reflect.Manifest[O[String, M]]]
<console>:70: error: erroneous or inaccessible type
implicitly[reflect.Manifest[O[String, M]]]
^ Internally, an error like is issued and swallowed:
|
sounds like that's on its way |
Implicit value of this type cannot be determined: Manifest[A[List]]. Type in REPL the following to reproduce:
Expected result: implicit manifest value should have been found.
The text was updated successfully, but these errors were encountered: