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

SO in inferExprAlternative on erroneous code

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      It is surprising that we have so little code coverage for inferExprAlternative. This breaks:

      class Base[T]
      
      object Foo {
        def apply[T](a: Int): Base[T] = new Base[T]
        def apply[T](z: String): Base[T] = new Base[T]
      }
      
      object Test {
        def test[T]: Int = Foo[T]
      }
      

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          I get, with 2.9 or trunk:

          scalac ./a.scala 
          ./a.scala:12: error: type mismatch;
           found   : [T](z: String)Base[T] <and> (a: Int)Base[T]
           required: Int
            def test[T]: Int = Foo[T]
                                  ^
          one error found
          

          What do you see?

          Show
          Paul Phillips added a comment - I get, with 2.9 or trunk: scalac ./a.scala ./a.scala:12: error: type mismatch; found : [T](z: String)Base[T] <and> (a: Int)Base[T] required: Int def test[T]: Int = Foo[T] ^ one error found What do you see?
          Hide
          Hubert Plociniczak added a comment -

          Well it is because you applied my patch to trunk already. How I wish there was a good post-commit hook for that...

          Show
          Hubert Plociniczak added a comment - Well it is because you applied my patch to trunk already. How I wish there was a good post-commit hook for that...
          Hide
          Hubert Plociniczak added a comment -

          Try with M2

          Show
          Hubert Plociniczak added a comment - Try with M2
          Hide
          Hubert Plociniczak added a comment -

          Fixed in 4f99c2e589164c300d3e86c0de5a0d3ca9efd3f7

          Show
          Hubert Plociniczak added a comment - Fixed in 4f99c2e589164c300d3e86c0de5a0d3ca9efd3f7

            People

            • Assignee:
              Hubert Plociniczak
              Reporter:
              Hubert Plociniczak
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development