Skip to content

Instantly share code, notes, and snippets.

@paulp
Created November 11, 2008 15:45
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 paulp/23881 to your computer and use it in GitHub Desktop.
Save paulp/23881 to your computer and use it in GitHub Desktop.
** match **
[[syntax trees at end of typer]]// Scala source: orig1.scala
package <empty> {
@scala.this.serializable case abstract class Base extends lang.this.Object with scala.this.ScalaObject with scala.this.Product {
<method> def this(): <empty>.this.Base = {
Base.super.this();
()
};
override <method> def $tag(): scala.this.Int = 2063089;
override <method> def hashCode(): scala.this.Int = ScalaRunTime.this._hashCode(Base.this);
override <method> def toString(): scala.this.Predef.String = ScalaRunTime.this._toString(Base.this);
override <method> def equals(x$1: scala.this.Any): scala.this.Boolean = x$1.isInstanceOf[scala.this.AnyRef].&&(Base.this.eq(x$1).||(x$1 match {
case ()<empty>.this.Base() => true
case _ => false
}));
override <method> def productPrefix: lang.this.String = "Base";
override <method> def productArity: scala.this.Int = 0;
override <method> def productElement(x$1: scala.this.Int): scala.this.Any = x$1 match {
case _ => throw new lang.this.IndexOutOfBoundsException.this(x$1.toString())
}
};
class BaseA extends Base with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseA = {
BaseA.super.this();
()
}
};
class BaseB extends Base with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseB = {
BaseB.super.this();
()
}
};
class BaseHolder[T >: scala.this.Nothing <: scala.this.Any] extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseHolder[T] = {
BaseHolder.super.this();
()
}
};
@scala.this.serializable case class BaseCompare[I >: scala.this.Nothing <: <empty>.this.Base] extends lang.this.Object with scala.this.ScalaObject with scala.this.Product {
<caseaccessor> <paramaccessor> private[this] val base: <empty>.this.BaseHolder[I] = _;
<method> <stable> <caseaccessor> <accessor> <paramaccessor> def base: <empty>.this.BaseHolder[I] = BaseCompare.this.base;
<method> def this(base: <empty>.this.BaseHolder[I]): <empty>.this.BaseCompare[I] = {
BaseCompare.super.this();
()
};
override <method> def $tag(): scala.this.Int = 624842932;
override <method> def hashCode(): scala.this.Int = ScalaRunTime.this._hashCode(BaseCompare.this);
override <method> def toString(): scala.this.Predef.String = ScalaRunTime.this._toString(BaseCompare.this);
override <method> def equals(x$1: scala.this.Any): scala.this.Boolean = x$1.isInstanceOf[scala.this.AnyRef].&&(BaseCompare.this.eq(x$1).||(x$1 match {
case (<empty>.this.BaseHolder[<empty>.this.Base])<empty>.this.BaseCompare[<empty>.this.Base]((base$1 @ _)) if base$1.==(base) => true
case _ => false
}));
override <method> def productPrefix: lang.this.String = "BaseCompare";
override <method> def productArity: scala.this.Int = 1;
override <method> def productElement(x$1: scala.this.Int): scala.this.Any = x$1 match {
case 0 => base
case _ => throw new lang.this.IndexOutOfBoundsException.this(x$1.toString())
}
};
class testClass extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): <empty>.this.testClass = {
testClass.super.this();
()
};
private[this] val baseList: scala.this.List[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }] = scala.this.Nil;
<method> <stable> <accessor> def baseList: scala.this.List[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }] = testClass.this.baseList;
<method> def getHolding[I >: scala.this.Nothing <: <empty>.this.Base](diff: <empty>.this.BaseCompare[I&0]): <empty>.this.BaseCompare[I] = {
val holder: <empty>.this.BaseCompare[I&0] = testClass.this.baseList.find(((x$1: <empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }) => x$1.base.==(diff.base))) match {
case (<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base })scala.this.Some[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }]((base @ _)) => base
case scala.None => throw new java.this.lang.IllegalStateException.this("Expected data not found")
};
holder
}
};
final <module> <synthetic> object Base extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): object <empty>.this.Base = {
Base.super.this();
()
};
case <method> <synthetic> def unapply(x$0: <empty>.this.Base): scala.this.Boolean = true
};
final <module> <synthetic> object BaseCompare extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): object <empty>.this.BaseCompare = {
BaseCompare.super.this();
()
};
case <method> <synthetic> def unapply[I >: scala.this.Nothing <: <empty>.this.Base](x$0: <empty>.this.BaseCompare[I&0]): scala.this.Some[<empty>.this.BaseHolder[I]] = scala.Some.apply[<empty>.this.BaseHolder[I&0]](x$0.base);
case <method> <synthetic> def apply[I >: scala.this.Nothing <: <empty>.this.Base](base: <empty>.this.BaseHolder[I&0]): <empty>.this.BaseCompare[I] = new <empty>.this.BaseCompare[I&0].this(base)
}
}
** getOrElse **
orig2.scala:13: error: type mismatch;
found : <empty>.this.BaseCompare[_$1&0] where <deferred> <mixedin/existential> type _$1&0 <: <empty>.this.Base
required: <empty>.this.BaseCompare[I&0]
val holder:BaseCompare[I] = baseList.find(_.base == diff.base) getOrElse(
^
[[syntax trees at end of typer]]// Scala source: orig2.scala
package <empty> {
@scala.this.serializable case abstract class Base extends lang.this.Object with scala.this.ScalaObject with scala.this.Product {
<method> def this(): <empty>.this.Base = {
Base.super.this();
()
};
override <method> def $tag(): scala.this.Int = 2063089;
override <method> def hashCode(): scala.this.Int = ScalaRunTime.this._hashCode(Base.this);
override <method> def toString(): scala.this.Predef.String = ScalaRunTime.this._toString(Base.this);
override <method> def equals(x$1: scala.this.Any): scala.this.Boolean = x$1.isInstanceOf[scala.this.AnyRef].&&(Base.this.eq(x$1).||(x$1 match {
case ()<empty>.this.Base() => true
case _ => false
}));
override <method> def productPrefix: lang.this.String = "Base";
override <method> def productArity: scala.this.Int = 0;
override <method> def productElement(x$1: scala.this.Int): scala.this.Any = x$1 match {
case _ => throw new lang.this.IndexOutOfBoundsException.this(x$1.toString())
}
};
class BaseA extends Base with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseA = {
BaseA.super.this();
()
}
};
class BaseB extends Base with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseB = {
BaseB.super.this();
()
}
};
class BaseHolder[T >: scala.this.Nothing <: scala.this.Any] extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): <empty>.this.BaseHolder[T] = {
BaseHolder.super.this();
()
}
};
@scala.this.serializable case class BaseCompare[I >: scala.this.Nothing <: <empty>.this.Base] extends lang.this.Object with scala.this.ScalaObject with scala.this.Product {
<caseaccessor> <paramaccessor> private[this] val base: <empty>.this.BaseHolder[I] = _;
<method> <stable> <caseaccessor> <accessor> <paramaccessor> def base: <empty>.this.BaseHolder[I] = BaseCompare.this.base;
<method> def this(base: <empty>.this.BaseHolder[I]): <empty>.this.BaseCompare[I] = {
BaseCompare.super.this();
()
};
override <method> def $tag(): scala.this.Int = 624842932;
override <method> def hashCode(): scala.this.Int = ScalaRunTime.this._hashCode(BaseCompare.this);
override <method> def toString(): scala.this.Predef.String = ScalaRunTime.this._toString(BaseCompare.this);
override <method> def equals(x$1: scala.this.Any): scala.this.Boolean = x$1.isInstanceOf[scala.this.AnyRef].&&(BaseCompare.this.eq(x$1).||(x$1 match {
case (<empty>.this.BaseHolder[<empty>.this.Base])<empty>.this.BaseCompare[<empty>.this.Base]((base$1 @ _)) if base$1.==(base) => true
case _ => false
}));
override <method> def productPrefix: lang.this.String = "BaseCompare";
override <method> def productArity: scala.this.Int = 1;
override <method> def productElement(x$1: scala.this.Int): scala.this.Any = x$1 match {
case 0 => base
case _ => throw new lang.this.IndexOutOfBoundsException.this(x$1.toString())
}
};
class testClass extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): <empty>.this.testClass = {
testClass.super.this();
()
};
private[this] val baseList: scala.this.List[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }] = scala.this.Nil;
<method> <stable> <accessor> def baseList: scala.this.List[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }] = testClass.this.baseList;
<method> def getHolding[I >: scala.this.Nothing <: <empty>.this.Base](diff: <empty>.this.BaseCompare[I&0]): <empty>.this.BaseCompare[I] = {
val holder: <empty>.this.BaseCompare[I&0] = testClass.this.baseList.find(((x$1: <empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }) => x$1.base.==(diff.base))).getOrElse[<empty>.this.BaseCompare[_$1] forSome { <deferred> <mixedin/existential> type _$1 <: <empty>.this.Base }](throw new java.this.lang.IllegalStateException.this("Expected data not found"));
holder
}
};
final <module> <synthetic> object Base extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): object <empty>.this.Base = {
Base.super.this();
()
};
case <method> <synthetic> def unapply(x$0: <empty>.this.Base): scala.this.Boolean = true
};
final <module> <synthetic> object BaseCompare extends lang.this.Object with scala.this.ScalaObject {
<method> def this(): object <empty>.this.BaseCompare = {
BaseCompare.super.this();
()
};
case <method> <synthetic> def unapply[I >: scala.this.Nothing <: <empty>.this.Base](x$0: <empty>.this.BaseCompare[I&0]): scala.this.Some[<empty>.this.BaseHolder[I]] = scala.Some.apply[<empty>.this.BaseHolder[I&0]](x$0.base);
case <method> <synthetic> def apply[I >: scala.this.Nothing <: <empty>.this.Base](base: <empty>.this.BaseHolder[I&0]): <empty>.this.BaseCompare[I] = new <empty>.this.BaseCompare[I&0].this(base)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment