Skip to content

Implicit conversion from parent trait with a call-by-name parameter (Boolean example) #9660

Open
@scabug

Description

@scabug

I have encountered an unexpected behavior when dealing with implicit conversions and call-by-name parameters.
The summary of the problem can be found here:
http://stackoverflow.com/questions/34957948/scala-implicit-conversion-from-parent-trait

My use-case is a bit different (instead of class Wrp, we use abstract type Rep), but the behavior in that case is the same. I have simplified the example as much as I could, while still trying to keep it relevant.

We have found a workaround - not to use call-by-name parameters, but that is not the behavior that we are aiming for for BooleanOps, as we do not want to eagerly evaluate the second argument if we do not need to.

Background information:
This issue was encountered when trying to fully move LMS from the Scala-Virtualized compiler into the macro world. Because we can no longer rely on infix_ methods, we are using implicit conversions. It was a very long time until I was able to pinpoint the source of the error, as there were other non-obvious issues and behaviors surrounding it, but in the end we could explain and circumvent all of those, except this last one. I read relevant parts in all the Scala materials I could get my hands on and asked for help from several colleagues. Unable to find a definitive solution, I was advised to post a ticket here.

I hope you have some insight in this behavior and that you would be able to solve or clarify it.

Thank you,
Boris Perović

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions