The Artima Developer Community
Sponsored Link

ScalaTest/ScalaUtils Forum
ShouldMatchers not work for objects with length and size

3 replies on 1 page. Most recent reply: Oct 18, 2012 10:48 PM by Bill Venners

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Uwe Doerl

Posts: 1
Nickname: grayal
Registered: May, 2012

ShouldMatchers not work for objects with length and size Posted: May 12, 2012 8:21 AM
Reply to this message Reply
Advertisement
I got a compiler error on objects with both implemented methods length and size.

object should be ...

type mismatch; found: expect.type (..) required: ?{val should(x$1: ?>: org.scalatest.matchers.Matcher[Any] <: Any): ?}
Note that implicit conversions are not applicable because they are ambiguous:
both method convertHasIntLengthFieldToLengthShouldWrapper in trait ShouldMatchers of type [T <: AnyRef{val length: Int}](o: T)PathTest.this.LengthShouldWrapper[T]
and method convertHasIntSizeFieldToSizeShouldWrapper in trait ShouldMatchers of type [T <: AnyRef{val size: Int}](o: T)PathTest.this.SizeShouldWrapper[T]
are possible conversion functions from expect.type to ?{val should(x$1: ?>: org.scalatest.matchers.Matcher[Any] <: Any): ?}


Each class with trait scala.collection.SeqLike[+A, +Repr] contains both methods!


Bill Venners

Posts: 2242
Nickname: bv
Registered: Jan, 2002

Re: ShouldMatchers not work for objects with length and size Posted: May 12, 2012 1:36 PM
Reply to this message Reply
That's odd. I'll try that and see what's up.

John Kurkowski

Posts: 1
Nickname: bluu
Registered: Oct, 2012

Re: ShouldMatchers not work for objects with length and size Posted: Oct 18, 2012 6:00 PM
Reply to this message Reply
Any luck with this?

Bill Venners

Posts: 2242
Nickname: bv
Registered: Jan, 2002

Re: ShouldMatchers not work for objects with length and size Posted: Oct 18, 2012 10:48 PM
Reply to this message Reply
Hi John,

Sorry, I think I forgot about this one. But I think I understand it. We have structural type implicit conversions, and they are causing problems if an object's structure fits both. Although I said it before, I *will* check into it.

Bill

Flat View: This topic has 3 replies on 1 page
Topic: Scala IDE 3 Previous Topic   Next Topic Topic: Nested before and after for FunSpec


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us