aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-27 18:11:14 +0100
committerMartin Odersky <odersky@gmail.com>2013-10-27 18:11:14 +0100
commit41e7d9d46177650d23447f99989e8347aca56e71 (patch)
treeb9537aea50e7fb8df2c0709dfb6bd394531a8999 /src/dotty/tools/dotc/typer/Typer.scala
parent1a83f5f653c6005bd3c207e1b6ab5bd57f6a9896 (diff)
downloaddotty-41e7d9d46177650d23447f99989e8347aca56e71.tar.gz
dotty-41e7d9d46177650d23447f99989e8347aca56e71.tar.bz2
dotty-41e7d9d46177650d23447f99989e8347aca56e71.zip
Fixing `apply` insertion.
Previously we encountered failures with polymorphic applies and infinite recursion in case of errors. The commit contains fixes for both problems.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 1bdc5516c..c6d419675 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -920,7 +920,9 @@ class Typer extends Namer with Applications with Implicits {
def tryInsertApply(tree: Tree, pt: Type)(fallBack: StateFul[Tree] => Tree)(implicit ctx: Context): Tree =
tryEither {
- implicit ctx => typedSelect(untpd.Select(untpd.TypedSplice(tree), nme.apply), pt)
+ implicit ctx =>
+ val sel = typedSelect(untpd.Select(untpd.TypedSplice(tree), nme.apply), pt)
+ if (sel.tpe.isError) sel else adapt(sel, pt)
} {
fallBack
}
@@ -1008,7 +1010,7 @@ class Typer extends Namer with Applications with Implicits {
}
def adaptToArgs(wtp: Type, pt: FunProto) = wtp match {
- case _: MethodType => tree
+ case _: MethodType | _: PolyType => tree
case _ => tryInsertApply(tree, pt) {
val more = tree match {
case Apply(_, _) => " more"
@@ -1086,6 +1088,8 @@ class Typer extends Namer with Applications with Implicits {
tree match {
case _: MemberDef | _: PackageDef | _: Import | _: WithoutType[_] => tree
case _ => tree.tpe.widen match {
+ case ErrorType =>
+ tree
case ref: TermRef =>
adaptOverloaded(ref)
case poly: PolyType =>