Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      Welcome to Scala version 2.9.0.r23530-b20101116170224 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> val x = "abc" 
      x: java.lang.String = abc
      
      scala> x.getClass.getMethod("toString")
      res0: java.lang.reflect.Method = public java.lang.String java.lang.String.toString()
      
      scala> res0.invoke(x)
      res1: java.lang.Object = abc
      
      scala> res0.invoke(x, Array[AnyRef](): _*)
      res2: java.lang.Object = abc
      
      scala> res0.invoke(x, List[AnyRef](): _*)
      res3: java.lang.Object = abc
      
      scala> res0.invoke(x, (Nil: List[AnyRef]): _*)
      res4: java.lang.Object = abc
      
      scala> res0.invoke(x, Nil: _*)            
      exception when traversing line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (immutable.this.Nil: _*))
      exception when traversing private[this] val res3: java.lang.Object = line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (immutable.this.Nil: _*))
      exception when traversing java.lang.Object with ScalaObject {
        def this(): object $$iw.$$iw = {
      [...]
      Exception in thread "main" java.util.NoSuchElementException: head of empty list
      	at scala.collection.immutable.Nil$$.head(List.scala:389)
      	at scala.collection.immutable.Nil$$.head(List.scala:386)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer$$$$anonfun$$sequenceToArray$$1$$1.apply(UnCurry.scala:419)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer$$$$anonfun$$sequenceToArray$$1$$1.apply(UnCurry.scala:418)
      	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:104)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer.sequenceToArray$$1(UnCurry.scala:417)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer.transformVarargs$$1(UnCurry.scala:429)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer.transformArgs(UnCurry.scala:449)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer$$$$anonfun$$mainTransform$$3.apply(UnCurry.scala:589)
      	at scala.tools.nsc.transform.UnCurry$$UnCurryTransformer$$$$anonfun$$mainTransform$$3.apply(UnCurry.scala:587)
      

        Activity

        Hide
        Paul Phillips added a comment -

        Here's another one, crashing a different way.

        scala> res0.invoke(x, Seq(): _*)
        exception when traversing line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (collection.this.Seq.apply[Nothing](): _*))
        exception when traversing private[this] val res1: java.lang.Object = line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (collection.this.Seq.apply[Nothing](): _*))
        ...
        Exception in thread "main" scala.tools.nsc.symtab.Types$$TypeError: type mismatch;
         found   : scala.reflect.Manifest[Nothing]
         required: scala.reflect.ClassManifest[B]
        	at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:280)
        	at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:203)
        	at scala.tools.nsc.typechecker.Infer$$Inferencer.typeError(Infer.scala:213)
        	at scala.tools.nsc.typechecker.Infer$$Inferencer.typeErrorTree(Infer.scala:228)
        	at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:1018)
        	at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4175)
        	at scala.tools.nsc.typechecker.Typers$$Typer.typedArg(Typers.scala:2189)
        	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2200)
        	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2199)
        	at scala.Tuple3$$Zipped$$$$anonfun$$map$$1.apply(Tuple3.scala:56)
        	at scala.Tuple3$$Zipped$$$$anonfun$$map$$1.apply(Tuple3.scala:54)
        	at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
        
        Show
        Paul Phillips added a comment - Here's another one, crashing a different way. scala> res0.invoke(x, Seq(): _*) exception when traversing line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (collection.this.Seq.apply[Nothing](): _*)) exception when traversing private[this] val res1: java.lang.Object = line2$$object.$$iw.$$iw.res0.invoke(line0$$object.$$iw.$$iw.x, (collection.this.Seq.apply[Nothing](): _*)) ... Exception in thread "main" scala.tools.nsc.symtab.Types$$TypeError: type mismatch; found : scala.reflect.Manifest[Nothing] required: scala.reflect.ClassManifest[B] at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:280) at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:203) at scala.tools.nsc.typechecker.Infer$$Inferencer.typeError(Infer.scala:213) at scala.tools.nsc.typechecker.Infer$$Inferencer.typeErrorTree(Infer.scala:228) at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:1018) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4175) at scala.tools.nsc.typechecker.Typers$$Typer.typedArg(Typers.scala:2189) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2200) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2199) at scala.Tuple3$$Zipped$$$$anonfun$$map$$1.apply(Tuple3.scala:56) at scala.Tuple3$$Zipped$$$$anonfun$$map$$1.apply(Tuple3.scala:54) at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
        Hide
        Martin Odersky added a comment -

        (In r23762) Closes SI-4024. No review.

        Show
        Martin Odersky added a comment - (In r23762) Closes SI-4024 . No review.
        Hide
        Paul Phillips added a comment -

        There was no test case checked in, a prerequisite to the fact that this bug is still with us. res0.invoke(x, Nil: _) still crashes as of r24610, as does res0.invoke(x, Seq(): _).

        Here is a test case with both crashers for the convenience of the eventual closer.

        object Test {
          def main(args: Array[String]): Unit = {
            val x = "abc"
            val m = x.getClass.getMethod("toString")
            m.invoke(x, Nil: _*)
            m.invoke(x, Seq(): _*)
          }
        }
        
        Show
        Paul Phillips added a comment - There was no test case checked in, a prerequisite to the fact that this bug is still with us. res0.invoke(x, Nil: _ ) still crashes as of r24610, as does res0.invoke(x, Seq(): _ ). Here is a test case with both crashers for the convenience of the eventual closer. object Test { def main(args: Array[String]): Unit = { val x = "abc" val m = x.getClass.getMethod("toString") m.invoke(x, Nil: _*) m.invoke(x, Seq(): _*) } }
        Hide
        Paul Phillips added a comment -

        See also SI-4207 which I marked duplicate.

        Show
        Paul Phillips added a comment - See also SI-4207 which I marked duplicate.
        Hide
        Paul Phillips added a comment -

        Fixed in 6912ff828db2 .

        Show
        Paul Phillips added a comment - Fixed in 6912ff828db2 .

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Paul Phillips
            TracCC:
            Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development