Scala Programming Language
  1. Scala Programming Language
  2. SI-8091

String interpolation with f"" causes compilation failure

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.11.0-M7
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: None
    • Environment:

      OS X Mavericks

      Description

      Doing this in the REPL. Worked Monday 16/12, stopped working Tuesday 17/12.

      scala> "börk börk" flatMap (ch ⇒ if (ch > 127) f"&#x${ch}%04x;" else "" + ch)
      <console>:8: error: type mismatch;
       found   : Comparable[String]
       required: scala.collection.GenTraversableOnce[?]
                    "börk börk" flatMap (ch ⇒ if (ch > 127) f"&#x${ch}%04x;" else "" + ch)
      
      ^

        Activity

        Hide
        Paul Phillips added a comment -

        ca2dbe55eb

        "In this formulation, it becomes apparent that the first typecheck is redundant. If something is ascribed with some type, then typechecking the ascription against that type does nothing useful."

        ...except maybe induce an implicit conversion, as in from String => StringOps.

        Show
        Paul Phillips added a comment - ca2dbe55eb "In this formulation, it becomes apparent that the first typecheck is redundant. If something is ascribed with some type, then typechecking the ascription against that type does nothing useful." ...except maybe induce an implicit conversion, as in from String => StringOps.
        Hide
        Eugene Burmako added a comment -

        It's actually https://github.com/scala/scala/commit/a3b33419b02cafb7e2c6fed6dd96151859fc7d77. The whitebox change is at fault here, because fast track macros are considered whitebox by default.

        Show
        Eugene Burmako added a comment - It's actually https://github.com/scala/scala/commit/a3b33419b02cafb7e2c6fed6dd96151859fc7d77 . The whitebox change is at fault here, because fast track macros are considered whitebox by default.
        Show
        Eugene Burmako added a comment - https://github.com/scala/scala/pull/3288
        Hide
        Paul Phillips added a comment -

        Man, I thought I could shoot from the hip this one time.

        Show
        Paul Phillips added a comment - Man, I thought I could shoot from the hip this one time.

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Björn Antonsson
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development