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

Scalac does not check type equality for existential types

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: Scala 2.11.8
    • Fix Version/s: None
    • Component/s: Type Checker

      Description

      Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_77).
      Type in expressions for evaluation. Or try :help.
       
      scala> import language.existentials
      import language.existentials
       
      scala> val pair: (A => String, A) forSome { type A } = ( { a: Int => a.toString }, 19 )
      pair: (A => String, A) forSome { type A } = (<function1>,19)
       
      scala> pair._1(pair._2)
      <console>:13: error: type mismatch;
       found   : pair._2.type (with underlying type A)
       required: A
             pair._1(pair._2)
                          ^
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              atry 杨博
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: