Details

      Description

      Compiled in -M2, not presently.

      object C {
        def join(in: Seq[List[_]]): Int = error("TODO")
        def join[S](in: Seq[List[S]]): String = error("TODO")
       
        join(Seq[List[Int]]())
        // 
        // ./a.scala:13: error: ambiguous reference to overloaded definition,
        // both method join in object C of type [S](in: Seq[List[S]])String
        // and  method join in object C of type (in: Seq[List[_]])Int
        // match argument types (Seq[List[Int]])
        //   join(Seq[List[Int]]())
        //   ^
        // one error found
      }
      

        Attachments

          Activity

          Show
          moors Adriaan Moors added a comment - fixed by https://github.com/adriaanm/scala/commit/3e20bebd192444d8c1b079489292011e8030b532
          Hide
          milessabin Miles Sabin added a comment -

          Looking closely at 6.26.3 and the implementation of isAsSpecificAs I believe that it is correct to report an ambiguity in this case: the spec provides no justification for preferring the polymorphic join[S] over the monomorphic (albeit existential) join.

          Show
          milessabin Miles Sabin added a comment - Looking closely at 6.26.3 and the implementation of isAsSpecificAs I believe that it is correct to report an ambiguity in this case: the spec provides no justification for preferring the polymorphic join[S] over the monomorphic (albeit existential) join .
          Hide
          milessabin Miles Sabin added a comment -

          It seems that Dotty agrees that this should be ambiguous.

          Show
          milessabin Miles Sabin added a comment - It seems that Dotty agrees that this should be ambiguous.
          Hide
          moors Adriaan Moors added a comment -

          Miles convinced me this should be ambiguous. See https://github.com/scala/scala/pull/5376

          Show
          moors Adriaan Moors added a comment - Miles convinced me this should be ambiguous. See https://github.com/scala/scala/pull/5376
          Hide
          rytz Lukas Rytz added a comment -
          Show
          rytz Lukas Rytz added a comment - reverted in https://github.com/scala/scala/pull/5573
          Hide
          milessabin Miles Sabin added a comment -

          I'm not seeing the justification for reopening this. The behaviour is in line with the spec.

          Show
          milessabin Miles Sabin added a comment - I'm not seeing the justification for reopening this. The behaviour is in line with the spec.
          Hide
          moors Adriaan Moors added a comment -

          But it's not fixed since I had to revert my type inference hack that somehow made this work

          Show
          moors Adriaan Moors added a comment - But it's not fixed since I had to revert my type inference hack that somehow made this work
          Hide
          milessabin Miles Sabin added a comment -

          Understood, but the description is misleading now that we've established that ambiguity is the correct result.

          Show
          milessabin Miles Sabin added a comment - Understood, but the description is misleading now that we've established that ambiguity is the correct result.

            People

            • Assignee:
              moors Adriaan Moors
              Reporter:
              extempore Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: