aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-05 10:52:13 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-05 17:20:56 +0200
commita326e86d7d8389e8049a77b2cd75458f4573e294 (patch)
treec1daf83a17f692a722bf03eea84b8fb429e4579d /src/dotty/tools/dotc/core/Types.scala
parentdbb4b3f7923427af4ba6e04f258309421d5ee1ab (diff)
downloaddotty-a326e86d7d8389e8049a77b2cd75458f4573e294.tar.gz
dotty-a326e86d7d8389e8049a77b2cd75458f4573e294.tar.bz2
dotty-a326e86d7d8389e8049a77b2cd75458f4573e294.zip
Type checking function trees and closures.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 8df651180..07f3f284f 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -913,6 +913,15 @@ object Types {
// ----- misc -----------------------------------------------------------
+ /** Turn type into a function type.
+ * @pre this is a non-dependent method type.
+ */
+ def toFunctionType(implicit ctx: Context): Type = this match {
+ case mt @ MethodType(_, formals) if !mt.isDependent =>
+ val formals1 = formals mapConserve (_.underlyingIfRepeated)
+ defn.FunctionType(formals1, mt.resultType)
+ }
+
/** The signature of this type. This is by default NotAMethod,
* but is overridden for PolyTypes, MethodTypes, and TermRefWithSignature types.
* (the reason why we deviate from the "final-method-with-pattern-match-in-base-class"