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

Specialization + mixin => crash #7638

Closed
scabug opened this issue Jul 5, 2013 · 4 comments
Closed

Specialization + mixin => crash #7638

scabug opened this issue Jul 5, 2013 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 5, 2013

$ cat mb_spire_9_sp.scala 
package miniboxing.tests.compile

trait Ordering[@specialized(Int) A] {
  def eqv(x: Array[A], y: Array[A]): Boolean = false
}

trait ArrayVectorOrder[@specialized(Int) A] extends Ordering[A] {
  override def eqv(x: Array[A], y: Array[A]): Boolean = super.eqv(x, y)
}

object vectorOrder {
  implicit def arrayOrder[@specialized(Int) A]() = new ArrayVectorOrder[A] { }
}

$ ../../scala-trunk/build/quick/bin/scalac mb_spire_9_sp.scala trait

     while compiling: mb_spire_9_sp.scala
        during phase: mixin
     library version: version 2.10.3-20130625-164027-d22e8d282c
    compiler version: version 2.10.3-20130627-153946-54cb6af7db
  reconstructed args: 

  last tree to typer: TypeTree(class Array)
              symbol: class Array in package scala (flags: final)
   symbol definition: final class Array[T >: ? <: ?] extends Object
                 tpe: Array[Int]
       symbol owners: class Array -> package scala
      context owners: anonymous class anon$1 -> package compile

== Enclosing template or block ==

Template( // val <local $anon>: <notype>, tree.tpe=miniboxing.tests.compile.anon$1
  "java.lang.Object", "miniboxing.tests.compile.ArrayVectorOrder$mcI$sp" // parents
  ValDef(
    private
    "_"
    <tpt>
    <empty>
  )
  // 3 statements
  DefDef( // override def super=v(x: Object,y: Object): Boolean
    <method> override <bridge> <superaccessor> <specialized> <triedcooking> <notprotected>
    "super$eqv"
    []
    // 1 parameter list
    ValDef( // x: Object
      <param> <triedcooking>
      "x"
      <tpt> // tree.tpe=Object
      <empty>
    )
    ValDef( // y: Object
      <param> <triedcooking>
      "y"
      <tpt> // tree.tpe=Object
      <empty>
    )
    <tpt> // tree.tpe=Boolean
    Apply( // override def super=v(x: Array[Int],y: Array[Int]): Boolean in trait ArrayVectorOrder$mcI$sp, tree.tpe=Boolean
      vectorOrder$$anon$1.this."super$eqv" // override def super=v(x: Array[Int],y: Array[Int]): Boolean in trait ArrayVectorOrder$mcI$sp, tree.tpe=(x: Array[Int], y: Array[Int])Boolean
      // 2 arguments
      Apply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=Array[Int]
        TypeApply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=()Array[Int]
          "x"."$asInstanceOf" // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=[T0 >: ? <: ?]()T0
          <tpt> // tree.tpe=Array[Int]
        )
        Nil
      )
      Apply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=Array[Int]
        TypeApply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=()Array[Int]
          "y"."$asInstanceOf" // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=[T0 >: ? <: ?]()T0
          <tpt> // tree.tpe=Array[Int]
        )
        Nil
      )
    )
  )
  DefDef( // override def eqv(x: Object,y: Object): Boolean
    <method> override <bridge> <specialized>
    "eqv"
    []
    // 1 parameter list
    ValDef( // x: Object
      <param> <triedcooking>
      "x"
      <tpt> // tree.tpe=Object
      <empty>
    )
    ValDef( // y: Object
      <param> <triedcooking>
      "y"
      <tpt> // tree.tpe=Object
      <empty>
    )
    <tpt> // tree.tpe=Boolean
    Apply( // override def eqv(x: Array[Int],y: Array[Int]): Boolean in trait ArrayVectorOrder$mcI$sp, tree.tpe=Boolean
      vectorOrder$$anon$1.this."eqv" // override def eqv(x: Array[Int],y: Array[Int]): Boolean in trait ArrayVectorOrder$mcI$sp, tree.tpe=(x: Array[Int], y: Array[Int])Boolean
      // 2 arguments
      Apply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=Array[Int]
        TypeApply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=()Array[Int]
          "x"."$asInstanceOf" // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=[T0 >: ? <: ?]()T0
          <tpt> // tree.tpe=Array[Int]
        )
        Nil
      )
      Apply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=Array[Int]
        TypeApply( // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=()Array[Int]
          "y"."$asInstanceOf" // final def $asInstanceOf[T0 >: ? <: ?](): T0 in class Object, tree.tpe=[T0 >: ? <: ?]()T0
          <tpt> // tree.tpe=Array[Int]
        )
        Nil
      )
    )
  )
  DefDef( // def <init>(): miniboxing.tests.compile.anon$1
    <method> <triedcooking>
    "<init>"
    []
    List(Nil)
    <tpt> // tree.tpe=miniboxing.tests.compile.anon$1
    Block( // tree.tpe=Unit
      // 5 statements
      Apply( // def <init>(): Object in class Object, tree.tpe=Object
        vectorOrder$$anon$1.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
        Nil
      )
      Apply( // def $init$(): Unit in object Ordering$class, tree.tpe=Unit
        vectorOrder$$anon$1.this.$asInstanceOf[miniboxing.tests.compile.Ordering$class]()."$init$" // def $init$(): Unit in object Ordering$class, tree.tpe=()Unit
        Nil
      )
      Apply( // def $init$(): Unit in object ArrayVectorOrder$class, tree.tpe=Unit
        vectorOrder$$anon$1.this.$asInstanceOf[miniboxing.tests.compile.ArrayVectorOrder$class]()."$init$" // def $init$(): Unit in object ArrayVectorOrder$class, tree.tpe=()Unit
        Nil
      )
      Apply( // def $init$(): Unit in object Ordering$mcI$sp$class, tree.tpe=Unit
        vectorOrder$$anon$1.this.$asInstanceOf[miniboxing.tests.compile.Ordering$mcI$sp$class]()."$init$" // def $init$(): Unit in object Ordering$mcI$sp$class, tree.tpe=()Unit
        Nil
      )
      Apply( // def $init$(): Unit in object ArrayVectorOrder$mcI$sp$class, tree.tpe=Unit
        vectorOrder$$anon$1.this.$asInstanceOf[miniboxing.tests.compile.ArrayVectorOrder$mcI$sp$class]()."$init$" // def $init$(): Unit in object ArrayVectorOrder$mcI$sp$class, tree.tpe=()Unit
        Nil
      )
      ()
    )
  )
)

== Expanded type of tree ==

TypeRef(
  TypeSymbol(final class Array[T >: ? <: ?] extends Object)
  args = List(TypeRef(TypeSymbol(final abstract class Int extends )))
)

unhandled exception while transforming mb_spire_9_sp.scala
error: uncaught exception during compilation: java.lang.UnsupportedOperationException
error: java.lang.UnsupportedOperationException: tail of empty list
	at scala.collection.immutable.Nil$.tail(List.scala:339)
	at scala.collection.immutable.Nil$.tail(List.scala:334)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:131)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:124)
	at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:207)
	at scala.reflect.internal.SymbolTable.afterPhase(SymbolTable.scala:216)
	at scala.tools.nsc.Global.afterPickler(Global.scala:1104)
	at scala.tools.nsc.transform.Mixin.scala$tools$nsc$transform$Mixin$$rebindSuper(Mixin.scala:124)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:349)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:302)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.reflect.internal.Scopes$Scope.foreach(Scopes.scala:315)
	at scala.tools.nsc.transform.Mixin.scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1(Mixin.scala:302)
	at scala.tools.nsc.transform.Mixin$$anonfun$addMixedinMembers$3.apply(Mixin.scala:377)
	at scala.tools.nsc.transform.Mixin$$anonfun$addMixedinMembers$3.apply(Mixin.scala:373)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
	at scala.tools.nsc.transform.Mixin.addMixedinMembers(Mixin.scala:373)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.preTransform(Mixin.scala:540)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2904)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1280)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1279)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1278)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2927)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2925)
	at scala.collection.immutable.List.loop$1(List.scala:170)
	at scala.collection.immutable.List.mapConserve(List.scala:186)
	at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2925)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1297)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:464)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
	at scala.collection.Iterator$class.foreach(Iterator.scala:727)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:431)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1662)
	at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
	at scala.tools.nsc.Main$.doCompile(Main.scala:79)
	at scala.tools.nsc.Driver.process(Driver.scala:54)
	at scala.tools.nsc.Driver.main(Driver.scala:67)
	at scala.tools.nsc.Main.main(Main.scala)

Exception in thread "main" java.lang.UnsupportedOperationException: tail of empty list
	at scala.collection.immutable.Nil$.tail(List.scala:339)
	at scala.collection.immutable.Nil$.tail(List.scala:334)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:131)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:124)
	at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:207)
	at scala.reflect.internal.SymbolTable.afterPhase(SymbolTable.scala:216)
	at scala.tools.nsc.Global.afterPickler(Global.scala:1104)
	at scala.tools.nsc.transform.Mixin.scala$tools$nsc$transform$Mixin$$rebindSuper(Mixin.scala:124)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:349)
	at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:302)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.reflect.internal.Scopes$Scope.foreach(Scopes.scala:315)
	at scala.tools.nsc.transform.Mixin.scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1(Mixin.scala:302)
	at scala.tools.nsc.transform.Mixin$$anonfun$addMixedinMembers$3.apply(Mixin.scala:377)
	at scala.tools.nsc.transform.Mixin$$anonfun$addMixedinMembers$3.apply(Mixin.scala:373)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
	at scala.tools.nsc.transform.Mixin.addMixedinMembers(Mixin.scala:373)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.preTransform(Mixin.scala:540)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2904)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1280)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1279)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1278)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2927)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2925)
	at scala.collection.immutable.List.loop$1(List.scala:170)
	at scala.collection.immutable.List.mapConserve(List.scala:186)
	at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2925)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1297)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:1268)
	at scala.tools.nsc.transform.Mixin$MixinTransformer.transform(Mixin.scala:481)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:464)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
	at scala.collection.Iterator$class.foreach(Iterator.scala:727)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:431)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1662)
	at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
	at scala.tools.nsc.Main$.doCompile(Main.scala:79)
	at scala.tools.nsc.Driver.process(Driver.scala:54)
	at scala.tools.nsc.Driver.main(Driver.scala:67)
	at scala.tools.nsc.Main.main(Main.scala)
@scabug
Copy link
Author

@scabug scabug commented Jul 5, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7638?orig=1
Reporter: @VladUreche
Affected Versions: 2.10.3-RC1
Other Milestones: 2.11.0-M4

@scabug
Copy link
Author

@scabug scabug commented Jul 5, 2013

@VladUreche said:
Workaround: comment out override def eqv(x: Array[A], y: Array[A]): Boolean = super.eqv(x, y).

@scabug
Copy link
Author

@scabug scabug commented Jul 10, 2013

@scabug scabug closed this Jul 10, 2013
@scabug
Copy link
Author

@scabug scabug commented Jan 22, 2015

@VladUreche said:
Corresponding issue in miniboxing: miniboxing/miniboxing-plugin#25

@scabug scabug added this to the 2.10.3-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants