In my DSL I want this functionality:
class Test {
val compA = dependant(true, true)(Component("parameters"))
//and this shortcut:
val compB = dependant Component("parameters")
}
where:
def dependant(onEnable: Boolean, onDisable: Boolean)(c: Component): Component = {
//...
}
def dependant(c: Component): Component = dependant(false, true)(c)
all is fine, however, I cannot use this syntax:
val compB = dependant Component("parameters")
because it says
ambiguous reference to overloaded definition, both method dependant in class Test of type (onEnable: Boolean, onDisable: Boolean)(c: Component)Component and method dependant in class Test of type (c: Component)Component match expected type ?
But if I enclose the parameter in parenthesis:
val compB = dependant(Component("parameters"))
the error is gone. Obviously, the compiler fails in desugarating the parenthesisless case. Is this expected or am I doing something wrong? If this is expected, then Why? How can I reclaim the ability to use the method dependant
as a prefix, without parenthesis?