Skip to content

Instantly share code, notes, and snippets.

@adriaanm
Created December 8, 2011 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriaanm/1446946 to your computer and use it in GitHub Desktop.
Save adriaanm/1446946 to your computer and use it in GitHub Desktop.
verifyerror
[adriaan@lampmac13 scala (topic/virtpatmat)]$ qsc -Yvirtpatmat -Xprint:typer test/files/run/virtpatmat_alts.scala
sharedPrefix: List()
collapsedTreeMakers: List(AlternativesTreeMaker(value x1,List(if (x1.ne(null))
if (true.==(x1._1))
{
val x4: Boolean = x1._1;
if (true.==(x1._2))
{
val x5: Boolean = x1._2;
scala.this.Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6, if (x1.ne(null))
if (false.==(x1._1))
{
val x9: Boolean = x1._1;
if (false.==(x1._2))
{
val x10: Boolean = x1._2;
scala.this.Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6)))
sharedPrefix: List()
collapsedTreeMakers: List(AlternativesTreeMaker(value x1,List(if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x4: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x4.ne(null))
if (1.==(x4.hd$1))
{
val x5: Int = x4.hd$1;
if (immutable.this.Nil.==(x4.tl$1))
{
val x6: List[Int] = x4.tl$1;
scala.this.Some[List[Int]](x4)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7, if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x10: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x10.ne(null))
if (2.==(x10.hd$1))
{
val x11: Int = x10.hd$1;
if (immutable.this.Nil.==(x10.tl$1))
{
val x12: List[Int] = x10.tl$1;
scala.this.Some[List[Int]](x10)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7)))
sharedPrefix: List()
collapsedTreeMakers: List(TT(value x1,collection.immutable.::[Int]), P(value x15,,Substitution((value x,x15.hd$1), (value p14,x15.tl$1))), AlternativesTreeMaker(value x,List(if (4.==(x))
{
val x16: Int = x;
scala.this.Some[Int](x16)
}
else
zero7, if (5.==(x))
{
val x17: Int = x;
scala.this.Some[Int](x17)
}
else
zero7, if (6.==(x))
{
val x18: Int = x;
scala.this.Some[Int](x18)
}
else
zero7)), ET(value p14,immutable.this.Nil))
sharedPrefix: List(T6 cf. T2, T)
collapsedTreeMakers: List(ReusingCondTreeMaker(List((TT(value x1,collection.immutable.::[Int]),Some(TT(value x1,collection.immutable.::[Int]))), (P(value x21,,Substitution((value p19,x21.hd$1), (value p20,x21.tl$1))),None))), ET(value p19,7), ET(value p20,immutable.this.Nil))
sharedPrefix: List()
collapsedTreeMakers: List(ET(value x1,immutable.this.Nil))
[[syntax trees at end of typer]]// Scala source: virtpatmat_alts.scala
package <empty> {
final object Test extends Object with App with ScalaObject {
def this(): object Test = {
Test.super.this();
()
};
{
val zero6: Option[Nothing] = scala.this.None;
val x1: (Boolean, Boolean) = scala.Tuple2.apply[Boolean, Boolean](true, true);
var matchRes11: Int = 0;
var keepGoing12: Boolean = true;
immutable.this.List.apply[() => Option[(Boolean, Boolean)]]((() => if (x1.ne(null))
if (true.==(x1._1))
{
val x4: Boolean = x1._1;
if (true.==(x1._2))
{
val x5: Boolean = x1._2;
scala.this.Some.apply[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6), (() => if (x1.ne(null))
if (false.==(x1._1))
{
val x9: Boolean = x1._1;
if (false.==(x1._2))
{
val x10: Boolean = x1._2;
scala.this.Some.apply[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6)).dropWhile(((altThunk14: () => Option[(Boolean, Boolean)]) => {
val altOpt15: Option[(Boolean, Boolean)] = altThunk14.apply();
if (altOpt15.ne(zero6))
{
val x13: (Boolean, Boolean) = altOpt15.get;
{
matchRes11 = 1;
keepGoing12 = false;
{
zero6;
()
}
}
};
keepGoing12
}));
if (keepGoing12)
throw new MatchError(x1)
else
matchRes11
};
{
var rc32: Boolean = false;
var x15: collection.immutable.::[Int] = null.asInstanceOf[collection.immutable.::[Int]];
{
val zero7: Option[Nothing] = scala.this.None;
val x1: List[Int] = immutable.this.List.apply[Int](5);
val matchRes33: Unit = ();
var keepGoing13: Boolean = true;
{
{
{
immutable.this.List.apply[() => Option[List[Int]]]((() => if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x4: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x4.ne(null))
if (1.==(x4.hd$1))
{
val x5: Int = x4.hd$1;
if (immutable.this.Nil.==(x4.tl$1))
{
val x6: List[Int] = x4.tl$1;
scala.this.Some.apply[List[Int]](x4)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7), (() => if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x10: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x10.ne(null))
if (2.==(x10.hd$1))
{
val x11: Int = x10.hd$1;
if (immutable.this.Nil.==(x10.tl$1))
{
val x12: List[Int] = x10.tl$1;
scala.this.Some.apply[List[Int]](x10)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7)).dropWhile(((altThunk28: () => Option[List[Int]]) => {
val altOpt29: Option[List[Int]] = altThunk28.apply();
if (altOpt29.ne(zero7))
{
val x22: List[Int] = altOpt29.get;
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
{
zero7;
()
}
}
};
keepGoing13
}));
if (keepGoing13)
if (x1.isInstanceOf[collection.immutable.::[Int]])
{
rc32 = true;
x15 = x1.asInstanceOf[collection.immutable.::[Int]];
if (x15.ne(null))
immutable.this.List.apply[() => Option[Int]]((() => if (4.==(x15.hd$1))
{
val x16: Int = x15.hd$1;
scala.this.Some.apply[Int](x16)
}
else
zero7), (() => if (5.==(x15.hd$1))
{
val x17: Int = x15.hd$1;
scala.this.Some.apply[Int](x17)
}
else
zero7), (() => if (6.==(x15.hd$1))
{
val x18: Int = x15.hd$1;
scala.this.Some.apply[Int](x18)
}
else
zero7)).dropWhile(((altThunk30: () => Option[Int]) => {
val altOpt31: Option[Int] = altThunk30.apply();
if (altOpt31.ne(zero7))
{
val x23: Int = altOpt31.get;
if (immutable.this.Nil.==(x15.tl$1))
{
val x24: List[Int] = x15.tl$1;
{
scala.this.Predef.println("OK ".+(x23));
keepGoing13 = false;
{
zero7;
()
}
}
}
else
{
zero7;
()
}
};
keepGoing13
}))
else
zero7
}
else
zero7
else
zero7
};
if (keepGoing13)
if (rc32)
{
if (7.==(x15.hd$1))
{
val x25: Int = x15.hd$1;
if (immutable.this.Nil.==(x15.tl$1))
{
val x26: List[Int] = x15.tl$1;
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
zero7
}
}
else
zero7
}
else
zero7
}
else
zero7
else
zero7
};
if (keepGoing13)
if (immutable.this.Nil.==(x1))
{
val x27: List[Int] = x1;
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
zero7
}
}
else
zero7
else
zero7
};
if (keepGoing13)
throw new MatchError(x1)
else
matchRes33
}
}
}
}
[adriaan@lampmac13 scala (topic/virtpatmat)]$ qsc -Yvirtpatmat -Xprint:uncurry test/files/run/virtpatmat_alts.scala
sharedPrefix: List()
collapsedTreeMakers: List(AlternativesTreeMaker(value x1,List(if (x1.ne(null))
if (true.==(x1._1))
{
val x4: Boolean = x1._1;
if (true.==(x1._2))
{
val x5: Boolean = x1._2;
scala.this.Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6, if (x1.ne(null))
if (false.==(x1._1))
{
val x9: Boolean = x1._1;
if (false.==(x1._2))
{
val x10: Boolean = x1._2;
scala.this.Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6)))
sharedPrefix: List()
collapsedTreeMakers: List(AlternativesTreeMaker(value x1,List(if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x4: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x4.ne(null))
if (1.==(x4.hd$1))
{
val x5: Int = x4.hd$1;
if (immutable.this.Nil.==(x4.tl$1))
{
val x6: List[Int] = x4.tl$1;
scala.this.Some[List[Int]](x4)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7, if (x1.isInstanceOf[collection.immutable.::[Int]])
{
val x10: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]];
if (x10.ne(null))
if (2.==(x10.hd$1))
{
val x11: Int = x10.hd$1;
if (immutable.this.Nil.==(x10.tl$1))
{
val x12: List[Int] = x10.tl$1;
scala.this.Some[List[Int]](x10)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7)))
sharedPrefix: List()
collapsedTreeMakers: List(TT(value x1,collection.immutable.::[Int]), P(value x15,,Substitution((value x,x15.hd$1), (value p14,x15.tl$1))), AlternativesTreeMaker(value x,List(if (4.==(x))
{
val x16: Int = x;
scala.this.Some[Int](x16)
}
else
zero7, if (5.==(x))
{
val x17: Int = x;
scala.this.Some[Int](x17)
}
else
zero7, if (6.==(x))
{
val x18: Int = x;
scala.this.Some[Int](x18)
}
else
zero7)), ET(value p14,immutable.this.Nil))
sharedPrefix: List(T6 cf. T2, T)
collapsedTreeMakers: List(ReusingCondTreeMaker(List((TT(value x1,collection.immutable.::[Int]),Some(TT(value x1,collection.immutable.::[Int]))), (P(value x21,,Substitution((value p19,x21.hd$1), (value p20,x21.tl$1))),None))), ET(value p19,7), ET(value p20,immutable.this.Nil))
sharedPrefix: List()
collapsedTreeMakers: List(ET(value x1,immutable.this.Nil))
[[syntax trees at end of uncurry]]// Scala source: virtpatmat_alts.scala
package <empty> {
object Test extends Object with App with ScalaObject {
def this(): object Test = {
Test.super.this();
()
};
{
val zero6: Option[Nothing] = scala.this.None;
val x1: (Boolean, Boolean) = new (Boolean, Boolean)(true, true);
var matchRes11: Int = 0;
var keepGoing12: Boolean = true;
immutable.this.List.apply[() => Option[(Boolean, Boolean)]](scala.this.Predef.wrapRefArray[() => Option[(Boolean, Boolean)]](Array[() => Option[(Boolean, Boolean)]]{{
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[(Boolean, Boolean)]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[(Boolean, Boolean)] = if (x1.ne(null))
if (true.==(x1._1()))
{
val x4: Boolean = x1._1();
if (true.==(x1._2()))
{
val x5: Boolean = x1._2();
new Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6
};
(new anonymous class $anonfun(): () => Option[(Boolean, Boolean)])
}, {
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[(Boolean, Boolean)]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[(Boolean, Boolean)] = if (x1.ne(null))
if (false.==(x1._1()))
{
val x9: Boolean = x1._1();
if (false.==(x1._2()))
{
val x10: Boolean = x1._2();
new Some[(Boolean, Boolean)](x1)
}
else
zero6
}
else
zero6
else
zero6
};
(new anonymous class $anonfun(): () => Option[(Boolean, Boolean)])
}})).dropWhile({
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1[() => Option[(Boolean, Boolean)],Boolean] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(altThunk14: () => Option[(Boolean, Boolean)]): Boolean = {
val altOpt15: Option[(Boolean, Boolean)] = altThunk14.apply();
if (altOpt15.ne(zero6))
{
val x13: (Boolean, Boolean) = altOpt15.get();
{
matchRes11 = 1;
keepGoing12 = false;
{
zero6;
()
}
}
};
keepGoing12
}
};
(new anonymous class $anonfun(): () => Option[(Boolean, Boolean)] => Boolean)
});
if (keepGoing12)
throw new MatchError(x1)
else
matchRes11
};
{
var rc32: Boolean = false;
var x15: collection.immutable.::[Int] = null.asInstanceOf[collection.immutable.::[Int]]();
{
val zero7: Option[Nothing] = scala.this.None;
val x1: List[Int] = immutable.this.List.apply[Int](scala.this.Predef.wrapIntArray(Array[Int]{5}));
val matchRes33: Unit = ();
var keepGoing13: Boolean = true;
{
{
{
immutable.this.List.apply[() => Option[List[Int]]](scala.this.Predef.wrapRefArray[() => Option[List[Int]]](Array[() => Option[List[Int]]]{{
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[List[Int]]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[List[Int]] = if (x1.isInstanceOf[collection.immutable.::[Int]]())
{
val x4: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]]();
if (x4.ne(null))
if (1.==(x4.hd$1()))
{
val x5: Int = x4.hd$1();
if (immutable.this.Nil.==(x4.tl$1()))
{
val x6: List[Int] = x4.tl$1();
new Some[List[Int]](x4)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7
};
(new anonymous class $anonfun(): () => Option[List[Int]])
}, {
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[List[Int]]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[List[Int]] = if (x1.isInstanceOf[collection.immutable.::[Int]]())
{
val x10: collection.immutable.::[Int] = x1.asInstanceOf[collection.immutable.::[Int]]();
if (x10.ne(null))
if (2.==(x10.hd$1()))
{
val x11: Int = x10.hd$1();
if (immutable.this.Nil.==(x10.tl$1()))
{
val x12: List[Int] = x10.tl$1();
new Some[List[Int]](x10)
}
else
zero7
}
else
zero7
else
zero7
}
else
zero7
};
(new anonymous class $anonfun(): () => Option[List[Int]])
}})).dropWhile({
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1[() => Option[List[Int]],Boolean] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(altThunk28: () => Option[List[Int]]): Boolean = {
val altOpt29: Option[List[Int]] = altThunk28.apply();
if (altOpt29.ne(zero7))
{
val x22: List[Int] = altOpt29.get();
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
{
zero7;
()
}
}
};
keepGoing13
}
};
(new anonymous class $anonfun(): () => Option[List[Int]] => Boolean)
});
if (keepGoing13)
if (x1.isInstanceOf[collection.immutable.::[Int]]())
{
rc32 = true;
x15 = x1.asInstanceOf[collection.immutable.::[Int]]();
if (x15.ne(null))
immutable.this.List.apply[() => Option[Int]](scala.this.Predef.wrapRefArray[() => Option[Int]](Array[() => Option[Int]]{{
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[Int]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[Int] = if (4.==(x15.hd$1()))
{
val x16: Int = x15.hd$1();
new Some[Int](x16)
}
else
zero7
};
(new anonymous class $anonfun(): () => Option[Int])
}, {
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[Int]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[Int] = if (5.==(x15.hd$1()))
{
val x17: Int = x15.hd$1();
new Some[Int](x17)
}
else
zero7
};
(new anonymous class $anonfun(): () => Option[Int])
}, {
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Option[Int]] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(): Option[Int] = if (6.==(x15.hd$1()))
{
val x18: Int = x15.hd$1();
new Some[Int](x18)
}
else
zero7
};
(new anonymous class $anonfun(): () => Option[Int])
}})).dropWhile({
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1[() => Option[Int],Boolean] with Serializable {
def this(): anonymous class $anonfun = {
$anonfun.super.this();
()
};
final def apply(altThunk30: () => Option[Int]): Boolean = {
val altOpt31: Option[Int] = altThunk30.apply();
if (altOpt31.ne(zero7))
{
val x23: Int = altOpt31.get();
if (immutable.this.Nil.==(x15.tl$1()))
{
val x24: List[Int] = x15.tl$1();
{
scala.this.Predef.println("OK ".+(x23));
keepGoing13 = false;
{
zero7;
()
}
}
}
else
{
zero7;
()
}
};
keepGoing13
}
};
(new anonymous class $anonfun(): () => Option[Int] => Boolean)
})
else
zero7
}
else
zero7
else
zero7
};
if (keepGoing13)
if (rc32)
{
if (7.==(x15.hd$1()))
{
val x25: Int = x15.hd$1();
if (immutable.this.Nil.==(x15.tl$1()))
{
val x26: List[Int] = x15.tl$1();
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
zero7
}
}
else
zero7
}
else
zero7
}
else
zero7
else
zero7
};
if (keepGoing13)
if (immutable.this.Nil.==(x1))
{
val x27: List[Int] = x1;
{
scala.this.Predef.println("FAILED");
keepGoing13 = false;
zero7
}
}
else
zero7
else
zero7
};
if (keepGoing13)
throw new MatchError(x1)
else
matchRes33
}
}
}
}
warning: there were 3 unchecked warnings; re-run with -unchecked for details
one warning found
[adriaan@lampmac13 scala (topic/virtpatmat)]$
$ qs Test
java.lang.VerifyError: (class: Test$delayedInit$body, method: apply signature: ()Ljava/lang/Object;) Incompatible object argument for function call
at Test$.<init>(virtpatmat_alts.scala:1)
at Test$.<clinit>(virtpatmat_alts.scala)
at Test.main(virtpatmat_alts.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:90)
at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:38)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:159)
at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:90)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:159)
at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:92)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment