Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-3237

patch that adds warning for implicit methods with by-name parameters

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Lint
    • Labels:
      None

      Description

      Attached is a patch that adds an option `-Ywarn-by-name`. This option enables a warning when an implicit method has a call-by-name parameter.

      It is a common mistake to assume an entire block will be passed to the implicit. It is explicitly mentioned in the specification that implicits with call-by-name parameters are allowed, otherwise I would have suggested disallowing this entirely.

      I see that the fix for the similar ticket SI-2688 was implemented in the parser, but it was easier for me to do it in !RefChecks.

      It is only lightly tested. If this patch is of interest, I'll add tests.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                odersky Martin Odersky
                Reporter:
                harrah Mark Harrah
                TracCC:
                Johannes Rudolph
              • Votes:
                2 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: