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

Error with partially applied functions and variable length argument lists #5966

Closed
scabug opened this issue Jun 22, 2012 · 4 comments
Closed

Error with partially applied functions and variable length argument lists #5966

scabug opened this issue Jun 22, 2012 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jun 22, 2012

The following REPL session illustrates the problem:

scala> object o { def apply(i: AnyRef*)(j: String) = i }
defined module o

scala> o()("")
res1: Seq[AnyRef] = List() // RIGHT

scala> (o()_)("")
res2: Seq[AnyRef] = WrappedArray(null) // WRONG

The problem doesn't show up with 2.10.0-M3.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 22, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5966?orig=1
Reporter: Juan Manuel Serrano (jserrano)
Affected Versions: 2.10.0-M4
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 22, 2012

@retronym said:
Here's a candidate fix, but I'd like to know why this suddenly appeared.

https://github.com/retronym/scala/compare/ticket/5966

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 23, 2012

@magarciaEPFL said:
The behavior in question results in 2.10-M4 from a lowering in uncurry, as shown below (before and after) for the snippets:

  def exprA = o()("")

  def exprB = (o()_)("")
// after_Typer.scala
def exprA: Seq[AnyRef] = o.apply()("");

def exprB: Seq[AnyRef] = {
  ((j: String) => o.apply(<empty>)(j))
}.apply("")
// after_Uncurry.scala
def exprA(): Seq[Object] = o.apply(immutable.this.Nil, "");

def exprB(): Seq[Object] = {
  {
    @SerialVersionUID(0) final <synthetic> 
    class $anonfun extends scala.runtime.AbstractFunction1[String,Seq[Object]] 
                      with Serializable {
      def <init>(): anonymous class $anonfun = {
        $anonfun.super.<init>();
        ()
      };
      final def apply(j: String): Seq[Object] = 
        o.apply(scala.this.Predef.wrapRefArray[Object](Array[Object]{<empty>}), j)
    };
    (new anonymous class $anonfun(): String => Seq[Object])
  }
}.apply("")
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 23, 2012

@scabug scabug closed this Jun 25, 2012
@scabug scabug added this to the 2.10.0-M4 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.