aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-21 11:57:27 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-21 11:57:27 +0200
commitdb35ebf5519fe1c7f2f2870691139edc93c3d0a3 (patch)
tree113c3627f21e36cffb999b90ebd0fa287d480cc4 /src/dotty/tools/dotc/typer/Typer.scala
parent1128d72e9b6ccc766c53b5f4872249aedafc00be (diff)
downloaddotty-db35ebf5519fe1c7f2f2870691139edc93c3d0a3.tar.gz
dotty-db35ebf5519fe1c7f2f2870691139edc93c3d0a3.tar.bz2
dotty-db35ebf5519fe1c7f2f2870691139edc93c3d0a3.zip
Refactoring to prototype scheme
- all prototypes now defined in Inferencing - there is a hook in type comparers which delegates to prototype comparison method isMatchedBy.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index cdcf43272..7702b1750 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -20,7 +20,7 @@ import NameOps._
import Flags._
import Decorators._
import ErrorReporting._
-import Applications.{FunProtoType, PolyProtoType, Compatibility, normalize}
+import Inferencing.{FunProto, PolyProto, Compatibility, normalize}
import EtaExpansion.etaExpand
import util.Positions._
import util.SourcePosition
@@ -56,27 +56,6 @@ object Typer {
value
}
}
-
- class SelectionProto(name: Name, tp: Type) extends RefinedType(WildcardType, name)(_ => tp) with Compatibility {
- override def viewExists(tp: Type, pt: Type)(implicit ctx: Context): Boolean = false
- override def matchesInfo(tp: Type)(implicit ctx: Context) = {
- def test(implicit ctx: Context) =
- isCompatible(normalize(tp), /*(new WildApprox) apply (needed?)*/ refinedInfo)
- test(ctx.fresh.withNewTyperState)
- }
- }
-
- def selectionProto(name: Name, tp: Type) =
- if (name.isConstructorName) WildcardType
- else {
- val rtp = tp match {
- case tp: SelectionProto => WildcardType
- case _ => tp
- }
- new SelectionProto(name, rtp)
- }
-
- object AnySelectionProto extends SelectionProto(nme.WILDCARD, WildcardType)
}
class Typer extends Namer with Applications with Implicits {
@@ -965,7 +944,7 @@ class Typer extends Namer with Applications with Implicits {
i"""none of the ${err.overloadedAltsStr(altDenots)}
|match $expectedStr""".stripMargin)
pt match {
- case pt: FunProtoType => tryInsertApply(tree, pt)(_ => noMatches)
+ case pt: FunProto => tryInsertApply(tree, pt)(_ => noMatches)
case _ => noMatches
}
case alts =>
@@ -975,7 +954,7 @@ class Typer extends Namer with Applications with Implicits {
}
}
- def adaptToArgs(tp: Type, pt: FunProtoType) = tp match {
+ def adaptToArgs(tp: Type, pt: FunProto) = tp match {
case _: MethodType => tree
case _ => tryInsertApply(tree, pt) {
def fn = err.refStr(methPart(tree).tpe)
@@ -1041,7 +1020,7 @@ class Typer extends Namer with Applications with Implicits {
case ref: TermRef =>
adaptOverloaded(ref)
case poly: PolyType =>
- if (pt.isInstanceOf[PolyProtoType]) tree
+ if (pt.isInstanceOf[PolyProto]) tree
else {
val tracked = ctx.track(poly)
val tvars = ctx.newTypeVars(tracked, tree.pos)
@@ -1049,7 +1028,7 @@ class Typer extends Namer with Applications with Implicits {
}
case tp =>
pt match {
- case pt: FunProtoType => adaptToArgs(tp, pt)
+ case pt: FunProto => adaptToArgs(tp, pt)
case _ => adaptNoArgs(tp)
}
}