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

Higher-kinded types and specialization #9227

Closed
scabug opened this issue Mar 16, 2015 · 3 comments · Fixed by scala/scala#9439
Closed

Higher-kinded types and specialization #9227

scabug opened this issue Mar 16, 2015 · 3 comments · Fixed by scala/scala#9439

Comments

@scabug
Copy link

scabug commented Mar 16, 2015

The following reduced test case exhibits the problem:

import scala.language.higherKinds

import scala.{specialized => sp}

trait TC[M[_], @sp(Int) A]

object Compiles {
  def f2[M[_], A](implicit ev: TC[M, A]): M[A] = ???
  def f1[M[_], A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
}

object CompilesNot {
  def f2[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = ???
  def f1[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
}

and fails to compile with:

[info] Compiling 1 Scala source to ...
[error] test.scala:14: type mismatch;
[error]  found   : TC[M[_],Int]
[error]  required: TC[M,Int]
[error]   def f1[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
[error]                                                                    ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed Mar 16, 2015 12:41:42 PM
@scabug
Copy link
Author

scabug commented Mar 16, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9227?orig=1
Reporter: Denis Rosset (denisrosset)
Affected Versions: 2.11.6

@HANNAH1234473
Copy link

The following reduced test case exhibits the problem:

import scala.language.higherKinds

import scala.{specialized => sp}

trait TC[M[_], @sp(Int) A]

object Compiles {
  def f2[M[_], A](implicit ev: TC[M, A]): M[A] = ???
  def f1[M[_], A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
}

object CompilesNot {
  def f2[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = ???
  def f1[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
}

and fails to compile with:

[info] Compiling 1 Scala source to ...
[error] test.scala:14: type mismatch;
[error]  found   : TC[M[_],Int]
[error]  required: TC[M,Int]
[error]   def f1[M[_], @sp(Int) A](implicit ev: TC[M, A]): M[A] = f2[M, A](ev)
[error]                                                                    ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed Mar 16, 2015 12:41:42 PM

@SethTisue
Copy link
Member

@HANNAH1234473 works in recent nightly build (2.13.5-bin-b5f244f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants