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
Compiler does not reevaluate apply's implicit each time apply is called, when the applications are in the same statement.
The compiler would be correct if test were a function, and the implicit was defined at the function definition site. In that case the implicit is only supposed to be evaluated in the first application to a function, where the type parameters are then fully determined.
However, this is not the case below, because the implicit is declared not for the function test but for the application function apply, and thus the type parameter A should be determined separately for each invocation of apply. It is proven as shown below by the fact that invoking apply with separate statements or even explicitly calling .apply more than once in the same statement does compile as expected.
Shelby Moore III (shelby) said:
Ah I see, but then why doesn't enclosing in parenthesis indicate to the compiler that the function call should be completed and the implicit implicitly resolved?
I had tried the following before submitting this bug, which is why I think I didn't entertain the possibility you mentioned.
@paulp said:
"Extraneous" parentheses are discarded by the parser, so implicit resolution never sees them. I agree one could reasonably hope for it to be otherwise.
Compiler does not reevaluate
apply
'simplicit
each timeapply
is called, when the applications are in the same statement.The compiler would be correct if
test
were a function, and theimplicit
was defined at the function definition site. In that case theimplicit
is only supposed to be evaluated in the first application to a function, where the type parameters are then fully determined.However, this is not the case below, because the
implicit
is declared not for the functiontest
but for the application functionapply
, and thus the type parameterA
should be determined separately for each invocation ofapply
. It is proven as shown below by the fact that invokingapply
with separate statements or even explicitly calling.apply
more than once in the same statement does compile as expected.The motivating use case is for a workaround to a use case that applies to bug SI-5550.
The text was updated successfully, but these errors were encountered: