aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-05 17:27:23 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-05 17:27:23 +0100
commit37c877d0781547bb5e26c05b1713b7f7b3ef0411 (patch)
treec1b88297c6d522102376032d4b0ae09715b39ced /src/dotty/tools/dotc/typer/Typer.scala
parent9d8c92d1d52fcfa95d57ce88d91dbb84c8ecfbd1 (diff)
downloaddotty-37c877d0781547bb5e26c05b1713b7f7b3ef0411.tar.gz
dotty-37c877d0781547bb5e26c05b1713b7f7b3ef0411.tar.bz2
dotty-37c877d0781547bb5e26c05b1713b7f7b3ef0411.zip
Handle "missing args" case when expected type is a singleton type.
Fixes #803.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index b1e4bb48a..c94c90d1d 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1343,6 +1343,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
def methodStr = err.refStr(methPart(tree).tpe)
+ def missingArgs = errorTree(tree,
+ d"""missing arguments for $methodStr
+ |follow this method with `_' if you want to treat it as a partially applied function""".stripMargin)
+
def adaptOverloaded(ref: TermRef) = {
val altDenots = ref.denot.alternatives
typr.println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
@@ -1475,12 +1479,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
else if (wtp.isImplicit)
err.typeMismatch(tree, pt)
else
- errorTree(tree,
- d"""missing arguments for $methodStr
- |follow this method with `_' if you want to treat it as a partially applied function""".stripMargin)
+ missingArgs
case _ =>
if (tree.tpe <:< pt) tree
else if (ctx.mode is Mode.Pattern) tree // no subtype check for pattern
+ else if (wtp.isInstanceOf[MethodType]) missingArgs
else {
typr.println(i"adapt to subtype ${tree.tpe} !<:< $pt")
//typr.println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt))