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
In the following code, whether an implicit conversion is found by the compiler depends on the order of modules in the file, and on whether the method is called explicitly in a seperate statement:
// code doesn't compile, no suitable implicit found for the last printlnobjectFooextendsApplication {
importUtils.string2FooString;
//println(string2FooString("%s = %s") % ("foo", "bar")); // this line causes next line to compile!
println("str"% ("foo", "bar"));
}
// if this module is moved to the top of the file, the code compilesobjectUtils {
classFooString(s: String) {
def% (arg1: String, arg2: String) = arg1+arg2;
}
implicitdefstring2FooString(s: String) =newFooString(s)
}