Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Documentation and API
    • Labels:
      None
    • Environment:

      Map flatMap

      Description

      this is described as:

       def flatMap[B](f: ((A, B)) => Traversable[B]): Map[B]
      

      obviously Map[B] doesn't exist, and it should probably be something like Iterable[B]?

        Issue Links

          Activity

          Hide
          Aleksandar Prokopec added a comment -

          Indeed. This is in fact the case with all the methods taking an implicit builder factory, not just `flatMap`.

          Doc comments can only be overridden if the method gets overridden, but one should not override all these methods in `MapLike` just to get the comments right. A solution would be to manually specify the dynamic return type macro named $$FactoryResult and use that instead of $$Coll in the use case.

          Show
          Aleksandar Prokopec added a comment - Indeed. This is in fact the case with all the methods taking an implicit builder factory, not just `flatMap`. Doc comments can only be overridden if the method gets overridden, but one should not override all these methods in `MapLike` just to get the comments right. A solution would be to manually specify the dynamic return type macro named $$FactoryResult and use that instead of $$Coll in the use case.
          Hide
          Aleksandar Prokopec added a comment -

          But that would mean having to redefine macro FactoryResult along with Coll and coll in all the collection classes.

          Show
          Aleksandar Prokopec added a comment - But that would mean having to redefine macro FactoryResult along with Coll and coll in all the collection classes.
          Hide
          Vlad Ureche added a comment -

          This is quite tricky to fix. Redefining the use case won't work, and I tried getting the correct type back in 891769fa:

          /**
           * @define Coll Iterable
           */
          class Iterable[T] {
            /**
             * @usecase def foo[T]: $Coll[T]
             */
            def foo[T: Numeric]: Iterable[T]
          }
          
          /**
           * @define Coll D1
           */
          class Map[A, B] extends Iterable[(A,B)] {
            protected type D1[_] = Map[A, B]
          }
          

          But that won't work well, as the return type of function f is not constrained to be (A,B) => (C,D).

          So, I'll close this bug as won't fix, and I created bug SI-6128 about making the use case generation fully automatic.

          Show
          Vlad Ureche added a comment - This is quite tricky to fix. Redefining the use case won't work, and I tried getting the correct type back in 891769fa : /** * @define Coll Iterable */ class Iterable[T] { /** * @usecase def foo[T]: $Coll[T] */ def foo[T: Numeric]: Iterable[T] } /** * @define Coll D1 */ class Map[A, B] extends Iterable[(A,B)] { protected type D1[_] = Map[A, B] } But that won't work well, as the return type of function f is not constrained to be (A,B) => (C,D) . So, I'll close this bug as won't fix, and I created bug SI-6128 about making the use case generation fully automatic.

            People

            • Assignee:
              Vlad Ureche
              Reporter:
              Sciss
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development