Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncurry signature transformation issue #9475

Closed
scabug opened this issue Sep 17, 2015 · 2 comments
Closed

Uncurry signature transformation issue #9475

scabug opened this issue Sep 17, 2015 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 17, 2015

$ cat uncurry-bug.scala 
trait Ctx {
  trait Tree
}

trait Lst[+A] {
  def zip[A1 >: A, B](that: Lst[B]): Nothing
}

object Test {

  /*
   * Question:
   *
   * Is it by design that there is a difference
   * between the behavior of scalac on the following
   * two methods, which only differ in the type param:
   */
  def foo1(c: Ctx)(l: Lst[c.Tree]) = l zip l
  def foo2[T](c: Ctx)(l: Lst[c.Tree]) = l zip l
}

sun@sun-cpu:~/workspace/dev-2.11/scala/sandbox(2.11.x)$ scalac -version
Scala compiler version 2.11.6-20150224-172222-092690e7bf -- Copyright 2002-2013, LAMP/EPFL
sun@sun-cpu:~/workspace/dev-2.11/scala/sandbox(2.11.x)$ scalac uncurry-bug.scala -Xprint:uncurry
[[syntax trees at end of                   uncurry]] // uncurry-bug.scala
package <empty> {
  abstract trait Ctx extends Object {
    def /*Ctx*/$init$(): Unit = {
      ()
    };
    abstract trait Tree extends Object
  };
  abstract trait Lst[+A] extends Object {
    def zip[A1 >: A, B](that: Lst[B]): Nothing
  };
  object Test extends Object {
    def <init>(): Test.type = {
      Test.super.<init>();
      ()
    };
    def foo1(c: Ctx, l: Lst[Ctx#Tree]): Nothing = {
      <synthetic> val l$1: Lst[Ctx#Tree] = l.asInstanceOf[Lst[Ctx#Tree]]();
      l$1.zip[c.Tree, c.Tree](l$1)
    };
    def foo2[T](c: Ctx, l: Lst[c.Tree]): Nothing = l.zip[c.Tree, c.Tree](l)
  }
}

Notice the two signatures after uncurry:

def foo1(c: Ctx, l: Lst[Ctx#Tree]): Nothing
def foo2[T](c: Ctx, l: Lst[c.Tree]): Nothing

I would say the 2nd one is incorrect, as it doesn't widen. Or is that a design decision?

@scabug
Copy link
Author

scabug commented Sep 17, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9475?orig=1
Reporter: @VladUreche
Affected Versions: 2.11.7

@scabug
Copy link
Author

scabug commented Sep 17, 2015

@SethTisue said:
Vlad's PR: scala/scala#4748

@scabug scabug closed this as completed Sep 17, 2015
@scabug scabug added the critical label Apr 7, 2017
@scabug scabug added this to the 2.11.8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants