aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-26 12:03:10 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-26 12:43:55 +0200
commit54acd26dcf377e2eb2a474399894e10cfd4322f5 (patch)
treea275062a8cab9e81b401a4745400f8db71fed1ae /src/dotty/tools/dotc/typer/Typer.scala
parentb7f5aa30383730dc1d2b34f9773695d0f5669bcd (diff)
downloaddotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.gz
dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.bz2
dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.zip
Added isRef method to determine whether a type is a typeref that refers to a symbol.
The alternative (tpe eq sym.typeConstructor) does not work because types are not unique. The alternative (tpe.typeSymbol == sym) does not work because other types than TypeRefs have typeSymbols.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 69b79a474..0c33aa026 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -387,7 +387,7 @@ class Typer extends Namer with Applications with Implicits {
def typedPair(tree: untpd.Pair, pt: Type)(implicit ctx: Context) = {
val (leftProto, rightProto) = pt.typeArgs match {
- case l :: r :: Nil if pt.typeSymbol == defn.PairClass => (l, r)
+ case l :: r :: Nil if pt isRef defn.PairClass => (l, r)
case _ => (WildcardType, WildcardType)
}
val left1 = typed(tree.left, leftProto)
@@ -468,7 +468,7 @@ class Typer extends Namer with Applications with Implicits {
else {
val params = args.asInstanceOf[List[ValDef]]
val protoFormals: List[Type] = pt match {
- case _ if pt.typeSymbol == defn.FunctionClass(params.length) =>
+ case _ if pt isRef defn.FunctionClass(params.length) =>
pt.typeArgs take params.length
case SAMType(meth) =>
val MethodType(_, paramTypes) = meth.info
@@ -1028,7 +1028,7 @@ class Typer extends Namer with Applications with Implicits {
val folded = ConstFold(tree, pt)
if (folded ne EmptyTree) return folded
// drop type if prototype is Unit
- if (pt.typeSymbol == defn.UnitClass)
+ if (pt isRef defn.UnitClass)
return tpd.Block(tree :: Nil, Literal(Constant()))
// convert function literal to SAM closure
tree match {