Navigation Menu

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

package object cannot applied type parameter #9090

Closed
scabug opened this issue Jan 15, 2015 · 2 comments
Closed

package object cannot applied type parameter #9090

scabug opened this issue Jan 15, 2015 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Jan 15, 2015

Described here
http://stackoverflow.com/questions/27669605/why-cant-the-compiler-infer-type-parameter-for-package-object-while-it-works-f

// Foo.scala
trait Echo [T] {
  def echo(t: T): Unit
}

trait IntEcho extends Echo[Int] {
  def echo(t: Int) = println(t)
}

object echo extends IntEcho
package object echo1  extends IntEcho

object App extends App {
  echo.echo(1)
  echo1.echo(1)
}

And while I try to compile it( the attachment), it would fail

/tmp $ scalac Foo.scala
Foo.scala:14: error: type mismatch;
 found   : Int(1)
 required: T
  echo1.echo(1)
             ^
one error found

@scabug
Copy link
Author

scabug commented Jan 15, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9090?orig=1
Reporter: jilen
Affected Versions: 2.11.4
Attachments:

  • Foo.scala (created on Jan 15, 2015 12:20:18 PM UTC, 237 bytes)

@scabug
Copy link
Author

scabug commented Jan 16, 2015

@retronym said:
Merging with #9074 as they fix for the two issues is the same.

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

2 participants