- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
"Error occured in an application involving default arguments."
I've got a situation where I have the following:
def getDocuments( hSig:Int, minLength: Option[Int] = None, maxLength: Option[ Int ] = None): List[ Document ] =
def getDocuments( hSig:String, minLength: Option[Int] = None, maxLength: Option[ Int ] = None): List[ Document ] =
When compiling I get an error:
[ERROR] /Users/faulkner/work/devel/dupeserver/src/dupeserver/DupeDetection.scala:43: error: ambiguous reference to overloaded definition,
[INFO] both method getDocuments$default$2 in object DAO of type => Option[Int]
[INFO] and method getDocuments$default$2 in object DAO of type => Option[Int]
[INFO] match expected type Option[Int]
[INFO] var docList = DAO.getDocuments( hSigInt )
Now given that the first args in each method are different, I thought the signatures for each method would be distinct and not conflicting with anything.
If I rename one of the methods to something else, it compiles fine.
Can anyone explain what I'm doing wrong?