Skip to content

Instantly share code, notes, and snippets.

@evantill
Last active December 27, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evantill/7367826 to your computer and use it in GitHub Desktop.
Save evantill/7367826 to your computer and use it in GitHub Desktop.
enqueue iterable error
//scalaVersion := "2.10.3"
object CompileError {
import collection.immutable.Queue
type IntQueue = Queue[Int]
val IntQueue = Queue
val q: IntQueue = IntQueue.empty[Int]
def add(elem:Int):IntQueue = q.enqueue(elem)
def add(elems:Iterable[Int]):IntQueue = q.enqueue(elems)
}
/*
[error] CompileError.scala.scala:10: type mismatch;
[error] found : Iterable[Int]
[error] required: Int
[error] def add(elems:Iterable[Int]):IntQueue = q.enqueue(elems)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment