Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
    • Environment:

      2.9.0-1 and 2.9.1-SNAPSHOT

      Description

      implicit doesn't work in case of type-aliases:

      class TypeAliasVsImplicitTest {
      
          class For[m[_], a](x: m[a]) {
             def map[b](y: a => b): m[b] = throw new Error
          }
          implicit def toFor[m[_], a](x: m[a]): For[m, a] = new For[m, a](x)
      
          trait MyList[A]
      
          def foo(xs: MyList[Int]) = xs.map(x => x) // compiles fine.
      
          type MyListOfInt = MyList[Int]
          def bar(xs: MyListOfInt) = xs.map(x => x) // doesn't compile: value map is not a member of TypeAliasVsImplicitTest.this.MyListOfInt
      }
      

        Activity

        Hide
        Paul Phillips added a comment -

        Regression against 2.8.1.

        Show
        Paul Phillips added a comment - Regression against 2.8.1.
        Hide
        Adriaan Moors added a comment - - edited

        finally we suffer from recklessly changing the search for implicit conversions to use the narrow type of the convertee (xs.type) rather than the widened one (MyListOfInt)!

        the problem was that unification in type constructor inference wasn't set up to deal with types that need to be widened and dealiased

        Show
        Adriaan Moors added a comment - - edited finally we suffer from recklessly changing the search for implicit conversions to use the narrow type of the convertee (xs.type) rather than the widened one (MyListOfInt)! the problem was that unification in type constructor inference wasn't set up to deal with types that need to be widened and dealiased
        Hide
        Commit Message Bot added a comment -

        (moors in r25092) closes #4692: unification in type constructor inference now widens and dealiases when necessary

        in 2.8.1 implicit conversion search started with a widened type, so that combo never came up

        no review

        Show
        Commit Message Bot added a comment - (moors in r25092 ) closes #4692: unification in type constructor inference now widens and dealiases when necessary in 2.8.1 implicit conversion search started with a widened type, so that combo never came up no review

          People

          • Assignee:
            Adriaan Moors
            Reporter:
            Shunsuke Sogame
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development