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

Different behavior of Manifest on type alias/classes. #11481

Closed
yufangong opened this Issue Apr 10, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@yufangong
Copy link

commented Apr 10, 2019

In an effort to apply Manifest on a Higher-kinded-type, we notice the difference between Seq and Option, then the type alias Seq and the direct class scala.collection.Seq.

scala> class MyType[F[_]]
warning: there was one feature warning; re-run with -feature for details
defined class MyType

scala> def bar[T: Manifest](t: T) = {}
bar: [T](t: T)(implicit evidence$1: Manifest[T])Unit

scala> bar(new MyType[Seq])
<console>:14: error: No Manifest available for MyType[Seq].
       bar(new MyType[Seq])
          ^

scala> bar(new MyType[Option])
<console>:14: error: kinds of the type arguments (Option) do not conform to the expected kinds of the type parameters (type T).
Option's type parameters do not match type T's expected parameters:
class Option has one type parameter, but type T has none
       bar(new MyType[Option])
          ^

scala> bar(new MyType[scala.collection.Seq])
<console>:14: error: kinds of the type arguments (Seq) do not conform to the expected kinds of the type parameters (type T).
Seq's type parameters do not match type T's expected parameters:
trait Seq has one type parameter, but type T has none
       bar(new MyType[scala.collection.Seq])
          ^

I'm curious about why and the underlying mechanism, thanks!

@eed3si9n

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

Hi @yufangong. Is this meant to be a question/discussion or actually a bug report suggesting that the error messages should be consistent across Seq, Option, and scala.collection.Seq type constructors?

@yufangong

This comment has been minimized.

Copy link
Author

commented Apr 17, 2019

Hey @eed3si9n, thanks for responding. This is a question, is there any better place to get this answered?

@SethTisue

This comment has been minimized.

@SethTisue SethTisue closed this Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.