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

REPL corruption after ambiguous implicit error

    Details

      Description

      Welcome to Scala version 2.11.0-20130330-204812-2a6e83a85e (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
      warning: there were 1 feature warning(s); re-run with -feature for details
      convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int
      
      scala> convert(Some(9))
      <console>:9: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int])
       --- because ---
      argument expression's type is not compatible with formal parameter type;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
                    convert(Some(9))
                    ^
      <console>:9: error: type mismatch;
       found   : Some[Int]
       required: F[_ <: F[_]]
                    convert(Some(9))
                                ^
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      
      scala> 0
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      error: type mismatch;
       found   : Some[Int]
       required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      Note that implicit conversions are not applicable because they are ambiguous:
       both method ArrowAssoc in object Predef of type [A](__leftOfArrow: A)ArrowAssoc[A]
       and method Ensuring in object Predef of type [A](__resultOfEnsuring: A)Ensuring[A]
       are possible conversion functions from Some[Int] to ?F forSome { type _$1 <: ?F forSome { type _$2 } }
      
      scala>
      

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -

          I expect the underlying problem is outside of the REPL, but shooting the messenger in the meantime.

          Show
          Jason Zaugg added a comment - I expect the underlying problem is outside of the REPL, but shooting the messenger in the meantime.
          Show
          Jason Zaugg added a comment - WIP: https://github.com/retronym/scala/compare/ticket/7319
          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/2370
          Hide
          Seth Tisue added a comment -

          see also SI-7345

          Show
          Seth Tisue added a comment - see also SI-7345
          Hide
          Seth Tisue added a comment -

          fwiw, a simpler way to reproduce it in 2.10.1:

          scala> Stream(0).toArray
          (succeeds)
          scala> Array(0) ++ Stream(0).toArray
          (fails)
          scala> Stream(0).toArray
          (fails even though it succeed before)
          

          this came up on IRC a while back and I was tardy about reporting it. pleased to see it's fixed already

          Show
          Seth Tisue added a comment - fwiw, a simpler way to reproduce it in 2.10.1: scala> Stream(0).toArray (succeeds) scala> Array(0) ++ Stream(0).toArray (fails) scala> Stream(0).toArray (fails even though it succeed before) this came up on IRC a while back and I was tardy about reporting it. pleased to see it's fixed already

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Jason Zaugg
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development