Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-5265

warn on implicit def without explicit result type

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: Backlog
    • Component/s: Compiler (Misc)
    • Environment:

      Windows 7, it happens on SBT compile as well as with a ScalaIDE (2.0.0 RC2)

      Description

      The following code snipet : https://gist.github.com/1427587
      does not compile.

      import java.util.Date
       
      trait TDate 
       
      trait TT[A1,T1]
       
      trait TTFactory[F,G] {
        def create(f: F) : TT[F,G]
        def sample: F
      }
       
      object Impls {
       
        // If the c1 is declared before c2, it compiles fine
        // or if the implicit's result type is specified explicitly
        implicit def c2(s: Date)/* : TT[Date, TDate] */ = c1.create(s)  
       
        implicit val c1 = new TTFactory[Date,TDate] {
          def create(v: Date): TT[Date,TDate] = sys.error("")
          def sample = new Date
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                maxime.levesque maxime.levesque
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: