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

Compiler crash inferring higher-kinded type from expected type with refinement

    Details

      Description

      The following will evince the compiler crash:

      abstract class Foo[Tc[_]] { def tc: Tc[_] }
      object Foo {
        def foo[Tc[_]](): Foo[Tc] { type T = Nothing } =
          new Foo { def tc = null.asInstanceOf[Tc[_]] }
      }
      

      It appears that in the absence of a type parameter to the `new Foo` instantiation, the type inferencer looks to the expected type of `foo` to try to infer it. In the presence of the type refinement in the expected type, this crashes the compiler.

      This doesn't crash in Scala 2.10.6 (although it doesn't compile), but does with every version from a random sample of 2.11.x releases.

      Could be related to SI-2712.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                milessabin Miles Sabin
                Reporter:
                propensive Jon Pretty
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: