We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider, if you will, the following code example:
object M4Prob extends App {
abstract class LengthWrapper { def length: Long }
implicit def convertGetLengthFieldToLongLengthWrapper(o: { val getLength: Long }): LengthWrapper = new LengthWrapper { def length = o.getLength }
implicit def convertHasLongGetLengthFieldToLengthShouldWrapper[T <: AnyRef { val getLength: Long}](o: T): LengthShouldWrapper[T] = new LengthShouldWrapperT
final class LengthShouldWrapper[A <: AnyRef <% LengthWrapper](left: A) {
def should(o: Any) { println("Length was: " + left.length) }
}
class Lengthy { def getLength: Long = 99L }
(new Lengthy) should "howdy" }
Under 2.9.1 and 2.10.0-M3, it compiles and when you run it, it correctly prints:
Length was: 99
Under 2.10.0-M4, it fails to compile with this error message:
M4Prob.scala:26: error: value should is not a member of M4Prob.Lengthy (new Lengthy) should "howdy" ^ one error found
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-5928?orig=1 Reporter: @bvenners See #963
Sorry, something went wrong.
@retronym said: [T <: {def getLength: Long}] is required now to admit Lengthy.
[T <: {def getLength: Long}]
Lengthy
No branches or pull requests
Consider, if you will, the following code example:
object M4Prob extends App {
abstract class LengthWrapper {
def length: Long
}
implicit def convertGetLengthFieldToLongLengthWrapper(o: { val getLength: Long }): LengthWrapper =
new LengthWrapper {
def length = o.getLength
}
implicit def convertHasLongGetLengthFieldToLengthShouldWrapper[T <: AnyRef { val getLength: Long}](o: T): LengthShouldWrapper[T] = new LengthShouldWrapperT
final class LengthShouldWrapper[A <: AnyRef <% LengthWrapper](left: A) {
}
class Lengthy {
def getLength: Long = 99L
}
(new Lengthy) should "howdy"
}
Under 2.9.1 and 2.10.0-M3, it compiles and when you run it, it correctly prints:
Length was: 99
Under 2.10.0-M4, it fails to compile with this error message:
M4Prob.scala:26: error: value should is not a member of M4Prob.Lengthy
(new Lengthy) should "howdy"
^
one error found
The text was updated successfully, but these errors were encountered: