You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i was experimenting with implicits trying to figure out exactly which implicit is picked when, and there was a problem which i cannot explain other than "it's not a feature, it's a bug!"
Correct1:
i import 2 conversions which are ambigous, compiler complains, everything ok.
Bug1:
Same situation, both conversions are imported - but the compiler doesn't complain.
@paulp said:
It would be helpful if you would not include large amounts of extraneous detail, and when attempting to contrast behavior of two pieces of code, if they did not appear to be written for two different bug reports. What are you are trying to report is presumably captured in the following.
objectTest {
objectO1 { implicitdeff(s: String):Int=1 }
objectO2 { implicitdeff(s: String):Int=2 }
objectO3 { implicitdeff1(s: String):Int=3 }
objectO4 { implicitdeff2(s: String):Int=4 }
// Import two implicits with the same name in the same scope.defm1= {
importO1._importO2._// Implicit usage compiles."a":Int// Explicit call to f fails.
f("a")
// ./c.scala:9: error: reference to f is ambiguous;// it is imported twice in the same scope by// import O2._// and import O1._// f("a")// ^
}
// Import two with different names in the same scope.defm2= {
importO3._importO4._// Explicit calls compile.
f1("a")
f2("a")
// Implicit usage fails."a":Int// ./a.scala:36: error: type mismatch;// found : String("a")// required: Int// Note that implicit conversions are not applicable because they are ambiguous:// both method f1 in object O3 of type (s: String)Int// and method f2 in object O4 of type (s: String)Int// are possible conversion functions from String("a") to Int// "a": Int// ^
}
}
i was experimenting with implicits trying to figure out exactly which implicit is picked when, and there was a problem which i cannot explain other than "it's not a feature, it's a bug!"
Correct1:
i import 2 conversions which are ambigous, compiler complains, everything ok.
Bug1:
Same situation, both conversions are imported - but the compiler doesn't complain.
see the whole thread for more details:
http://devnet.jetbrains.net/thread/433043
The text was updated successfully, but these errors were encountered: