aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala5
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala19
2 files changed, 16 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index e1254322e..4ededf796 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -456,8 +456,9 @@ object SymDenotations {
}
}
- /** Is this a user defined "def" method? Excluded are accessors. */
- final def isSourceMethod(implicit ctx: Context) = this is (Method, butNot = AccessorOrLabel)
+ /** Is this a user defined "def" method? Excluded are accessors and anonymous functions. */
+ final def isSourceMethod(implicit ctx: Context) =
+ this.is(Method, butNot = AccessorOrLabel) && !isAnonymousFunction
/** Is this a setter? */
final def isGetter(implicit ctx: Context) =
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 8293b0239..947d46ee0 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -653,13 +653,20 @@ class Namer { typer: Typer =>
lhsType orElse WildcardType
}
}
-
- val pt = mdef.tpt match {
- case _: untpd.DerivedTypeTree => WildcardType
- case TypeTree(untpd.EmptyTree) => inferredType
- case _ => WildcardType
+
+ val tptProto = mdef.tpt match {
+ case _: untpd.DerivedTypeTree =>
+ WildcardType
+ case TypeTree(untpd.EmptyTree) =>
+ inferredType
+ case TypedSplice(tpt: TypeTree) if !isFullyDefined(tpt.tpe, ForceDegree.none) =>
+ typedAheadExpr(mdef.rhs, tpt.tpe)
+ typr.println(i"determine closure result type to be ${tpt.tpe}")
+ WildcardType
+ case _ =>
+ WildcardType
}
- paramFn(typedAheadType(mdef.tpt, pt).tpe)
+ paramFn(typedAheadType(mdef.tpt, tptProto).tpe)
}
/** The type signature of a DefDef with given symbol */