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

Conflict with specs2 #10

Open
electricmonk opened this issue Jul 18, 2011 · 2 comments
Open

Conflict with specs2 #10

electricmonk opened this issue Jul 18, 2011 · 2 comments

Comments

@electricmonk
Copy link

When using an int conversion from IntImplicits, for instance 2.days in the context of a specs2 test, the implicit conversion from Int to DateTime conflicts with the one from specs2's TimeConversion, giving the following compilation error:

error: type mismatch;
found : Int(2)
required: ?{val days: ?}
Note that implicit conversions are not applicable because they are ambiguous:
both method RichInt in trait IntImplicits of type (n: Int)org.scala_tools.time.RichInt
and method intToRichLong in trait TimeConversions of type (v: Int)MongoMetaSiteDaoTest.this.RichLong
are possible conversion functions from Int(2) to ?{val days: ?}
Error occurred in an application involving default arguments.
val site1 = MetaSite(originTemplateId = new ObjectId().toString, ownerUserId = user, name = "site1", dateUpdated = DateTime.now + 2.days)

Not that I have an idea how to solve this but it's a bug nonetheless :)

@rpcgen
Copy link

rpcgen commented Apr 23, 2012

As far as I have read it cannot be solved because the overlapping implicit is defined by Specification. The only workaround I can figure out is to write some redundant functions to mark the target implementation like jday, joda_day or jodaDay

@mgilbir
Copy link

mgilbir commented Aug 28, 2012

You can mix in the trait org.specs2.time.NoTimeConversions and then use the implicits from scala-time

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

No branches or pull requests

3 participants