aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-17 15:53:34 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-17 15:53:34 +0100
commitab4ae7ada45201684c91550815f85a2cfab24e34 (patch)
treec78d457afb4d8e1e4cbbd9dd02f4ca416b60db5d /src/dotty/tools/dotc/typer/Typer.scala
parente3fdf97df2ce1ea7cd3a98cbdcce53789db1b3d3 (diff)
downloaddotty-ab4ae7ada45201684c91550815f85a2cfab24e34.tar.gz
dotty-ab4ae7ada45201684c91550815f85a2cfab24e34.tar.bz2
dotty-ab4ae7ada45201684c91550815f85a2cfab24e34.zip
Fixes to desugaring and indexing package objects
Plus some small tweaks in Typer
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index f590b7b87..df0757da2 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1009,25 +1009,22 @@ class Typer extends Namer with Applications with Implicits {
val altDenots = ref.denot.alternatives
println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
val alts = altDenots map (alt =>
- TermRef.withSig(ref.prefix, ref.name, alt.info.signature).withDenot(alt))
+ TermRef.withSig(ref.prefix, ref.name, alt.info.signature, alt))
def expectedStr = err.expectedTypeStr(pt)
resolveOverloaded(alts, pt)(ctx.fresh.withExploreTyperState) match {
case alt :: Nil =>
- adaptInterpolated(tree.withType(alt), pt)
+ adapt(tree.withType(alt), pt)
case Nil =>
def noMatches =
errorTree(tree,
i"""none of the ${err.overloadedAltsStr(altDenots)}
|match $expectedStr""".stripMargin)
- def hasEmptyParams(denot: SingleDenotation) = denot.info.paramTypess match {
- case Nil :: _ => true
- case _ => false
- }
+ def hasEmptyParams(denot: SingleDenotation) = denot.info.paramTypess == ListOfNil
pt match {
case pt: FunProto =>
tryInsertApply(tree, pt)((_, _) => noMatches)
case _ =>
- if (altDenots exists hasEmptyParams)
+ if (altDenots exists (_.info.paramTypess == ListOfNil))
typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt)
else
noMatches
@@ -1071,7 +1068,7 @@ class Typer extends Namer with Applications with Implicits {
}
}
adapt(tpd.Apply(tree, args), wtp.resultType)
- case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
+ case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
if ((defn.isFunctionType(pt) || (pt eq AnyFunctionProto)) &&
!tree.symbol.isConstructor)
etaExpand(tree, wtp)
@@ -1086,7 +1083,7 @@ class Typer extends Namer with Applications with Implicits {
else if (ctx.mode is Mode.Pattern) tree // no subtype check for pattern
else {
println(s"adapt to subtype ${tree.tpe} !<:< $pt") // !!!DEBUG
- println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt)) // !!!DEBUG
+ // println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt)) // !!!DEBUG
adaptToSubType(wtp)
}
}